Home
Cole R Lawrence edited this page Jul 18, 2013
·
3 revisions
This is an extendable tab system that only requires you have an ul
element on the page. It uses jQuery or Zepto for DOM manipulation and ties into event listeners for each thing it does.
Events can be listened to using the 'touchTabs.on' function.
touchTabs.on(<eventtype>,function(event,tabid){
// event: default event passed with the trigger
// tabid: the tabid of the tab involved in this event
});
This event type is triggered when a tab is created. This trigger passes 3 variables to the function although the last one -- which is the tab's title -- is not necessary in many cases.
touchTabs.on("tabcreate",function(event,tabid){
// event: default event passed with the trigger
// tabid: the tabid of the tab that was created
});
touchTabs.on("tabcreate",function(event,tabid,title){
// event: default event passed with the trigger
// tabid: the tabid of the tab that was created
// title: the header text of the tab
});
This event type is triggered when the user "activates" a tab by clicking on it, or closing the currently active tab.
touchTabs.on("tabactivate",function(event,tabid){
// event: default event passed with the trigger
// tabid: the tabid of the tab that became active
});
This event type is triggered when the a tab is closed, which can be triggered by javascript or the user clicking the close button.
touchTabs.on("tabclose",function(event,tabid){
// event: default event passed with the trigger
// tabid: the tabid of the tab that was closed
});