Created
September 5, 2017 16:44
-
-
Save ben-heath/1e7264b11adb63e6edb03f294ea35972 to your computer and use it in GitHub Desktop.
Link to specific tab on different page (or same page)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> <!-- remove script tag if putting in html --> | |
jQuery(document).ready(function(){ | |
if(window.location.hash != "") { | |
// Clicks the tab link so that it is the active one | |
jQuery('a[href="' + window.location.hash + '"]').click(); | |
// Animate scroll to the tab | |
jQuery('html, body').animate({scrollTop: window.location.hash.offset().top -100 }, 'slow'); | |
} | |
}); | |
</script> <!-- remove script tag if putting in html --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment