From 59fe6ca6abcf6bd496c18eb3756117e9f8314f9e Mon Sep 17 00:00:00 2001 From: R De Groot - pastorius Date: Tue, 7 Jan 2020 20:55:01 +0100 Subject: [PATCH] #11821 give deeplink-smudge a deeplink-offset to prevent scrolling behind a fixed menu at top of page. --- js/foundation.accordion.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- 2.47.2