Created
August 26, 2013 17:47
-
-
Save barbwiredmedia/6344371 to your computer and use it in GitHub Desktop.
jQuery - Twitter Bootstrap's Tab piece. This allows hotlinking to the tab (opens page, and opens tab specified in the url) as well as changes url on tab change. (Should keep the nav-tabs class the same.)
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> | |
$(function(){ | |
var hash = window.location.hash; | |
hash && $('ul.nav a[href="' + hash + '"]').tab('show'); | |
$('.nav-tabs a').click(function (e) { | |
$(this).tab('show'); | |
var scrollmem = $('body').scrollTop(); | |
window.location.hash = this.hash; | |
$('html,body').scrollTop(scrollmem); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment