]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: prevent to loose query params when reseting hash in magellan 10837/head
authorNicolas Coden <nicolas@ncoden.fr>
Thu, 4 Jan 2018 08:12:13 +0000 (09:12 +0100)
committerNicolas Coden <nicolas@ncoden.fr>
Thu, 4 Jan 2018 08:12:13 +0000 (09:12 +0100)
See: https://stackoverflow.com/a/5298684/4317384

js/foundation.magellan.js

index 42e7eaa170e5bd4525711c0a68ad2cf099ac055c..5c0f06dd3d18194de36e13e49382680bf3d30490 100644 (file)
@@ -178,7 +178,10 @@ class Magellan extends Plugin {
       }
       if(hash !== window.location.hash) {
         if(window.history.pushState){
-          var url = curIdx !== undefined ? hash : window.location.pathname;
+          // If there is no active idx, move to the same url without hash
+          // https://stackoverflow.com/a/5298684/4317384
+          var url = curIdx !== undefined ? hash : window.location.pathname + window.location.search;
+
           if(this.options.updateHistory){
             window.history.pushState({}, '', url);
           }else{