From: Julian Pustkuchen Date: Thu, 28 May 2020 15:06:32 +0000 (+0200) Subject: Magellan with data-offset does not trigger correctly on the first item #11754 X-Git-Tag: v6.7.1~71^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12084%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Magellan with data-offset does not trigger correctly on the first item #11754 Magellan with data-offset does not trigger correctly on the first item #11754 --- diff --git a/js/foundation.magellan.js b/js/foundation.magellan.js index 441efd40f..9ddb6aa88 100644 --- a/js/foundation.magellan.js +++ b/js/foundation.magellan.js @@ -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