]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
#11821 give deeplink-smudge a deeplink-offset to prevent scrolling behind a fixed... 11959/head
authorR De Groot - pastorius <junkmail@lefthandmedia.com>
Tue, 7 Jan 2020 19:55:01 +0000 (20:55 +0100)
committerR De Groot - pastorius <junkmail@lefthandmedia.com>
Tue, 7 Jan 2020 19:55:01 +0000 (20:55 +0100)
js/foundation.accordion.js

index e2f9116f068412a23a6da2b2aba28aef955a1dd4..dfc3eb7cea4a7796879b77b7abc1c4b9f1411782 100644 (file)
@@ -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