]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fix for Magellan issue #7308
authorRawikitua Isherwood <risherwood@gmail.com>
Sat, 8 Oct 2016 08:22:27 +0000 (21:22 +1300)
committerGitHub <noreply@github.com>
Sat, 8 Oct 2016 08:22:27 +0000 (21:22 +1300)
Now works with deep linking

js/foundation.magellan.js

index b9ab4dfa466be1d51071306c53d97e708018f2fd..187984f65ba532b2959c8dd021123dd9cfd974f6 100644 (file)
@@ -130,7 +130,7 @@ class Magellan {
         curIdx;
 
     if(winPos + this.winHeight === this.docHeight){ curIdx = this.points.length - 1; }
-    else if(winPos < this.points[0]){ curIdx = 0; }
+    else if(winPos < this.points[0]){ curIdx = undefined; }
     else{
       var isDown = this.scrollPos < winPos,
           _this = this,
@@ -144,7 +144,10 @@ class Magellan {
     this.$active = this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]').addClass(this.options.activeClass);
 
     if(this.options.deepLinking){
-      var hash = this.$active[0].getAttribute('href');
+      var hash = " ";
+      if(curIdx != undefined){
+        hash = this.$active[0].getAttribute('href');
+      }
       if(window.history.pushState){
         window.history.pushState(null, null, hash);
       }else{