Backbone.View-based Tabs. Saves state in the window's anchor.
To install the latest version with bower:
> bower install backbone.tabs --save
Simple initialization example:
var tabs = new Tabs({
el: tabsDomElement
});
You can initialize all tabs on the page using TabsManager:
var tabsManager = new TabsManager();
tabsManager.initTabsInside($('body'));
var tabs = tabsManager.get('tabsName'); // way to get tabs instances
Assuming we have tabs with two links as controls, #tab=first
and #tab=second
:
// after page load, the page's url ended with "#tab=first"
var tabs = tabsManager.get('tab');
tabs.getName(); // 'tab'
tabs.getActiveTabName(); // 'first'
tabs.show('second'); // hide "first" tab, show "second"
// now page's url ended with "#tab=second"
tabs.getActiveTabName(); // 'second'