Created
May 24, 2016 00:57
-
-
Save DiegoSalazar/5989a0cb39d3dd03952fcc322a266080 to your computer and use it in GitHub Desktop.
Reload the last selected tab based on the window hash
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
$.fn.rememberSelectedTab = (tabSelector = "aria_controls")-> | |
selectedTab = window.location.hash.replace "#", "" | |
if selectedTab && selectedTab != "" | |
$("[#{tabSelector}='#{selectedTab}']").click() | |
@each -> | |
$(@).find("ul.nav-tabs li").click -> | |
name = $(@).find("a").attr tabSelector | |
window.location.hash = name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment