]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fixed the scrolling behavior when auto-focus is active 9353/head
authorAbdullah Salem <abdullahsalem@outlook.com>
Wed, 9 Nov 2016 23:11:07 +0000 (02:11 +0300)
committerAbdullah Salem <abdullahsalem@outlook.com>
Wed, 9 Nov 2016 23:11:07 +0000 (02:11 +0300)
js/foundation.tabs.js

index 04215c87d2702e8d989568bf70b1f92355da9fa1..556f63d7316518c98f6ad805a208612ddffe1515 100644 (file)
@@ -69,8 +69,12 @@ class Tabs {
         'aria-labelledby': linkId
       });
 
-      if(isActive && _this.options.autoFocus){
-        $link.focus();
+      if(isActive && _this.options.autoFocus){  
+        $(window).load(function() {         
+          $('html, body').animate({ scrollTop: $elem.offset().top }, _this.options.deepLinkSmudgeDelay, () => {
+            $link.focus();
+          });
+        });
       }
 
       //use browser to open a tab, if it exists in this tabset