From: R De Groot - pastorius Date: Tue, 7 Jan 2020 19:55:01 +0000 (+0100) Subject: #11821 give deeplink-smudge a deeplink-offset to prevent scrolling behind a fixed... X-Git-Tag: v6.6.2^2~33^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11959%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git #11821 give deeplink-smudge a deeplink-offset to prevent scrolling behind a fixed menu at top of page. --- diff --git a/js/foundation.accordion.js b/js/foundation.accordion.js index e2f9116f0..dfc3eb7ce 100644 --- a/js/foundation.accordion.js +++ b/js/foundation.accordion.js @@ -102,7 +102,7 @@ class Accordion extends Plugin { if (this.options.deepLinkSmudge) { onLoad($(window), () => { var offset = this.$element.offset(); - $('html, body').animate({ scrollTop: offset.top }, this.options.deepLinkSmudgeDelay); + $('html, body').animate({ scrollTop: offset.top - this.options.deepLinkSmudgeOffset }, this.options.deepLinkSmudgeDelay); }); } @@ -383,6 +383,13 @@ Accordion.defaults = { * @default 300 */ deepLinkSmudgeDelay: 300, + /** + * If `deepLinkSmudge` is enabled, the offset for scrollToTtop to prevent overlap by a sticky element at the top of the page + * @option + * @type {number} + * @default 0 + */ + deepLinkSmudgeOffset: 0, /** * If `deepLink` is enabled, update the browser history with the open accordion * @option