Togglable tabs
javascript-tabs
Example tabs
Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus. Nested tabs are not supported.
Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus. Nested tabs are not supported.
Extends tabbed navigation
This plugin extends the tabbed navigation component to add tabbable areas.
Usage
Enable tabbable tabs via JavaScript (each tab needs to be activated individually):
You can activate individual tabs in several ways:
Markup
You can activate a tab or pill navigation without writing any JavaScript by simply specifying
data-toggle="tab"
ordata-toggle="pill"
on an element. Adding the nav and nav-tabs classes to the tabul
will apply the Bootstrap tab styling, while adding thenav
andnav-pills
classes will apply pill styling.Fade effect
To make tabs fade in, add
.fade
to each.tab-pane
. The first tab pane must also have.in
to properly fade in initial content.Methods
$().tab
Activates a tab element and content container. Tab should have either a data-target or an href targeting a container node in the DOM. In the above examples, the tabs are the
<a>
s withdata-toggle="tab"
attributes..tab('show')
Selects the given tab and shows its associated content. Any other tab that was previously selected becomes unselected and its associated content is hidden.
Events
When showing a new tab, the events fire in the following order:
hide.bs.tab
(on the current active tab)show.bs.tab
(on the to-be-shown tab)hidden.bs.tab
(on the previous active tab, the same one as for the hide.bs.tab event)shown.bs.tab
(on the newly-active just-shown tab, the same one as for the show.bs.tab event)If no tab was already active, then the
hide.bs.tab
andhidden.bs.tab
events will not be fired.event.target
andevent.relatedTarget
to target the active tab and the previous active tab (if available) respectively.event.target
andevent.relatedTarget
to target the active tab and the previous active tab (if available) respectively.event.target
andevent.relatedTarget
to target the current active tab and the new soon-to-be-active tab, respectively.event.target
andevent.relatedTarget
to target the previous active tab and the new active tab, respectively.