Web Development with jQuery (2015)
Part IV. Appendices
Appendix Q. Tabs
Tab Methods |
||
Method |
Description |
Return Value |
tabs(options) |
Makes the selected elements into tabs (see “Tab Options”). |
jQuery |
tabs('destroy') |
Removes the tabs' functionality completely from the document. |
jQuery |
tabs('disable') |
Disables all tabs. |
jQuery |
tabs('disable', index) |
Disables a tab by offset index. To disable multiple tabs, use the option method to set the disabled option with an Array of tab indices. |
jQuery |
tabs('enable') |
Enables all tabs. |
jQuery |
tabs('enable', index) |
Enables a tab by offset index. To enable multiple tabs, use the option method to set the disabled option with an Array of tab indices you wish to remain disabled. |
jQuery |
tabs('load', index) |
Loads the content of a tab provided via AJAX programmatically. |
jQuery |
tabs('option') |
Returns an object of key, value pairs for every set option. |
Object |
tabs('option', optionName, value) |
Sets the specified option to the specified value. |
jQuery |
tabs('refresh') |
Refreshes the positions of tabs that were added or removed from the DOM. |
jQuery |
tabs('widget') |
Returns a jQuery object of the tabs container. |
jQuery |
Tab Options |
||
Option |
Description |
Type |
active |
Determines which tab panel should be open. |
Boolean, Integer |
collapsible |
When the value is true, the active panel can be closed (meaning it is possible to have no active panel at all). |
Boolean |
disabled |
If a boolean is provided, it indicates whether all tabs are enabled or disabled. |
Boolean, Array |
event |
The type of event to be used for selecting a tab. For example, to activate a tab when the user's mouse enters the tab, use the value 'mouseover'. |
String |
heightStyle |
Controls how the height of each tab and each panel are applied. The options are: |
String |
hide |
Whether and how to animate the closing of a tab panel. |
Boolean, Number, String, Object |
show |
Whether and how to animate the opening of a tab panel. |
Boolean, Number, String, Object |
Tab Events |
||
Option |
Description |
Value |
activate |
A function executed when a tab has been activated. |
function(event, ui) |
beforeActivate |
A function executed before a tab has been activated. |
function(event, ui) |
beforeLoad |
A function executed before a tab is loaded. |
function(event, ui) |
create |
A function executed when tabs are created. |
function(event, ui) |
load |
A function executed when a tab has been loaded. |
function(event, ui) |
UI Object |
||
Option |
Description |
Type |
ui.ajaxSettings |
The settings used by jQuery.ajax to request content. |
Object |
ui.jqXHR |
The jQuery AJAX request object that is requesting content. |
jQuery AJAX |
ui.newPanel |
The panel that was just activated or about to be activated. |
jQuery |
ui.newTab |
The tab that was just activated or about to be activated. |
jQuery |
ui.oldPanel |
The panel that was just deactivated or about to be deactivated. |
jQuery |
ui.oldTab |
The tab that was just deactivated or about to be deactivated. |
jQuery |
ui.panel |
The panel being loaded or the active panel. |
jQuery |
ui.tab |
The tab being loaded or the active tab. |
jQuery |
Tab Styling |
|
Class |
Description |
ui-tabs-nav |
This is the whole menu. Use this as a base class. |
ui-tabs-selected |
This is the current tab. It's very important to create a strong visual indication of which tab is the current one. |
ui-tabs-unselect |
This is the class for all the tabs that are not selected but selectable. |
ui-tabs-deselectable |
This is the class for all tabs that can be deselected. |
ui-tabs-disabled |
For when a tab is disabled. Highly recommended to appear somewhat transparent or disabled. This is often done by graying the color. |
ui-tabs-panel |
These are the boxes that will have their visibility toggled. |
ui-tabs-hide |
This class hides the boxes (perhaps the most important class). |
Element |
Description |
<span> |
<span> elements are there to facilitate tricks like rounded corners and resizable backgrounds. |