Skip to content

zaycker/tabs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tabs

Backbone.View-based Tabs. Saves state in the window's anchor.

Installation

To install the latest version with bower:

> bower install backbone.tabs --save

Initialization

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 

Usage

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'

About

Tabs for Backbone

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%