Parcourir la source

Fix permalink with more than 1 digit in id

Permalink feature was working for #9 but failing for #12.
Jocelyn Delalande il y a 8 ans
Parent
commit
0bf0a78dc2
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      wifiwithme/static/map.js

+ 2 - 2
wifiwithme/static/map.js

@@ -117,7 +117,7 @@ $( document ).ready(function() {
 
         // Open popup if hash is present.
         if (window.location.hash) {
-            var id = window.location.hash.substr(-1);
+            var id = window.location.hash.slice(1);
             openMarker(id);
         }
         else {
@@ -130,7 +130,7 @@ $( document ).ready(function() {
 
         // Bind window hash change
         window.onhashchange = function() {
-            var id = window.location.hash.substr(-1);
+            var id = window.location.hash.slice(1);
             openMarker(id);
         }