]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Add offset to deeplink smudge as described in #12203
authorR De Groot - pastorius <junkmail@lefthandmedia.com>
Thu, 25 Feb 2021 12:02:21 +0000 (13:02 +0100)
committerR De Groot - pastorius <junkmail@lefthandmedia.com>
Thu, 25 Feb 2021 12:02:21 +0000 (13:02 +0100)
js/foundation.tabs.js

index ffc6a0c4abb8e100c9cb16aa1fe9e13f4dab2618..88e12dc5791926b70313a3fc0eb80e523b102be5 100644 (file)
@@ -132,7 +132,7 @@ class Tabs extends Plugin {
         // Roll up a little to show the titles
         if (this.options.deepLinkSmudge) {
           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);
         }
 
         /**
@@ -464,6 +464,14 @@ Tabs.defaults = {
    */
   deepLinkSmudgeDelay: 300,
 
+  /**
+   * If `deepLinkSmudge` is enabled, animation offset from the top for the deep link adjustment
+   * @option
+   * @type {number}
+   * @default 0
+   */
+  deepLinkSmudgeOffset: 0,
+
   /**
    * If `deepLink` is enabled, update the browser history with the open tab
    * @option