]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fix issue #10020 10050/head
authorKevin Ball <kmball11@gmail.com>
Fri, 19 May 2017 00:16:35 +0000 (17:16 -0700)
committerKevin Ball <kmball11@gmail.com>
Fri, 19 May 2017 00:16:35 +0000 (17:16 -0700)
js/foundation.magellan.js

index d2a8fb05ce84b94228277c7cdd2ea46028715f3f..1313fedf9f5df19cf1f4a7dda76a3a0a63cd1f07 100644 (file)
@@ -99,11 +99,14 @@ class Magellan extends Plugin {
         var arrival   = this.getAttribute('href');
         _this.scrollToLoc(arrival);
       });
-    $(window).on('popstate', function(e) {
+
+    this._deepLinkScroll = function(e) {
       if(_this.options.deepLinking) {
         _this.scrollToLoc(window.location.hash);
       }
-    });
+    };
+
+    $(window).on('popstate', this._deepLinkScroll);
   }
 
   /**
@@ -196,6 +199,7 @@ class Magellan extends Plugin {
       var hash = this.$active[0].getAttribute('href');
       window.location.hash.replace(hash, '');
     }
+    $(window).off('popstate', this._deepLinkScroll);
   }
 }