You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CHAPTER<br />
38<br />
<strong>Bootstrap</strong> Tab Plugin<br />
Tabs were introduced in the chapter <strong>Bootstrap</strong> Navigation Elements. By combining a few data attributes,<br />
you can easily create a tabbed interface. With this plugin you can transition through panes of local content in tabs<br />
or pills, even via dropdown menus.<br />
If you want to include this plugin functionality individually, then you will need tab.js. Else, as mentioned in the<br />
chapter <strong>Bootstrap</strong> Plugins Overview, you can include bootstrap.js or the minified bootstrap.min.js.<br />
Usage<br />
You can enable tabbable tabs in the following two ways:<br />
<br />
Via data attributes: you need to add data-toggle="tab" or data-toggle="pill" to the anchors.<br />
Adding the nav and nav-tabs classes to the tab ul will apply the <strong>Bootstrap</strong> tab styling, while adding<br />
thenav and nav-pills classes will apply pill styling.<br />
<br />
Home<br />
...<br />
<br />
Via JavaScript: you can enable tabs using Javscript as below :<br />
$('#myTab a').click(function (e) {<br />
e.preventDefault()<br />
$(this).tab('show')<br />
})<br />
Here’s an example of different ways to activate individual tabs:<br />
// Select tab by name<br />
$('#myTab a[href="#profile"]').tab('show')<br />
// Select first tab<br />
$('#myTab a:first').tab('show')<br />
// Select last tab<br />
$('#myTab a:last').tab('show')<br />
// Select third tab (0-indexed)<br />
TUTORIALS POINT<br />
Simply Easy Learning