Created
May 11, 2013 01:58
-
-
Save jsheely/5558625 to your computer and use it in GitHub Desktop.
Enable tabs that can be linked to directly by url ex. www.example.com/page.aspx#tab2
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
jQuery(document).ready(function(){ | |
var tabCollection="#tab-instanceId"; | |
var selectedTabHash = "#tab_" + window.location.hash.replace(/#/,""); | |
$(tabCollection).tabs() | |
.bind("tabsshow",function(event,ui){window.location.hash=ui.tab.hash.replace(/#/,"").replace(/tab_/,"");}) | |
.tabs("select", selectedTabHash); | |
$(window).bind('hashchange', function() { | |
$(tabCollection).tabs( "select" , "#tab_" + window.location.hash.replace(/#/,"")); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment