What is the best way of making these tabs persist?
http://twitter.github.com/bootstrap/javascript.html#tabs
To add some context, this is for a rails application. I'm passing an array [tab1, tab2] to my view, rendering both tabs and using the bootstrap tab plugin to toggle their visibility.
This code selects the right tab depending on the #hash and adds the right #hash when a tab is clicked. (this uses jquery)
In Coffeescript :
or in JS :
Here is another way to solve the Problem.
First add a line to the click event to show the hash in the Addressbar
Then make sure that the right tab is activated
onload
by adding this part to your document ready call.All together you can write this: