]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Magellan with data-offset does not trigger correctly on the first item #11754 12084/head
authorJulian Pustkuchen <Julian@Pustkuchen.com>
Thu, 28 May 2020 15:06:32 +0000 (17:06 +0200)
committerGitHub <noreply@github.com>
Thu, 28 May 2020 15:06:32 +0000 (17:06 +0200)
Magellan with data-offset does not trigger correctly on the first item #11754

js/foundation.magellan.js

index 441efd40fa0826b40d52d533236123c43c8842fa..9ddb6aa88ce052c8df4aa5fc9a8ed98fef88b769 100644 (file)
@@ -162,7 +162,7 @@ class Magellan extends Plugin {
 
     let activeIdx;
     // Before the first point: no link
-    if(newScrollPos < this.points[0]){ /* do nothing */ }
+    if(newScrollPos < this.points[0] - this.options.offset - (isScrollingUp ? this.options.threshold : 0)){ /* do nothing */ }
     // At the bottom of the page: last link
     else if(newScrollPos + this.winHeight === this.docHeight){ activeIdx = this.points.length - 1; }
     // Otherwhise, use the last visible link