Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DiegoSalazar/5989a0cb39d3dd03952fcc322a266080 to your computer and use it in GitHub Desktop.
Save DiegoSalazar/5989a0cb39d3dd03952fcc322a266080 to your computer and use it in GitHub Desktop.
Reload the last selected tab based on the window hash
$.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