var st = new SwitchTab({
tabs: $('.tabs a'),
containers: $('.containers .container')
}, {
triggerEvent: 'mouseover'
});
var st = new SwitchTab();
st.init({
tabs: $('.tabs a'),
containers: $('.containers .container'),
names: $('.tabs a').map(function(){return $(this).attr('name')})
}, {
triggerEvent: 'mouseover'
});
items
{
tabs: Array < DOMElement | JqueryObject | JquerySelectors > ,
containers: Array < DOMElement | JqueryObject | JquerySelectors > ,
names: Array < String > ,
enables: Array < Boolean >
}
or
[
{
tab: DOMElement | JqueryObject | JquerySelectors ,
container: DOMElement | JqueryObject | JquerySelectors ,
name: String ,
enable: Boolean
},
...
]
options
{
triggerEvent: String,
triggerDelay: Number,
activeClass: String
startIndex: Number
}
Same as above options for SwitchTab constructor
Get target item.
The target can be SwitchItem
| tab index
| tab name
| tab Element
| tab jQuery Object
If ignoreEnable
param true, return the option which ignore its enable prototype, otherwise return the option which its enable prototype is true.
Get target index.
The target can be SwitchItem
| tab index
| tab name
| tab Element
| tab jQuery Object
If ignoreEnable
param true, return the index which ignore its enable prototype, otherwise return the index which its enable prototype is true.
Add item
include tab and container to the end of Swtichtab storage array.
If index
param, then intert into the index postion.
Switch to target tab.
The target can be SwitchItem
| tab index
| tab name
| tab Element
| tab jQuery Object
Switch to previous tab
Switch to next tab
Enable the target tab.
If target
is integer, it's based on the true position of the invisible tab.
Disable the target tab.
If target
is integer, it's base on the current visible tab position.