This example illustrates how the responsive tabs works. It uses the standard Bootstrap responsive CSS and HTML, so it also adapts to your viewport and device. This page is using Bootstrap 3.3.6
To see the difference just resize the width of your window.
id
.deco-none
class and the first has an additional red-class
that are copied to the anchor tags in the accordions.test-class
that are copied to the div.panel-default
in the accordions.id
.Fourth ...
responsive
class to the ul
that is used to create the tabs.responsive
class to the div
that is used to create the tab-content.fakewaffle.responsiveTabs(['xs', 'sm']);
in your load up script, while passing an array of bootstrap sizes that you want the to be displayed as accordions, e.g. ['xs', 'sm'] which is used by default.fakewaffle.responsiveTabs();
function.
<ul class="nav nav-tabs responsive" id="myTab"> <li class="active"><a href="#home">Home</a></li> <li><a href="#profile">Profile</a></li> <li><a href="#messages">Messages</a></li> </ul> <div class="tab-content responsive"> <div class="tab-pane active" id="home">...content...</div> <div class="tab-pane" id="profile">...content...</div> <div class="tab-pane" id="messages">...content...</div> </div> <script type="text/javascript"> (function($) { fakewaffle.responsiveTabs(['xs', 'sm']); })(jQuery); </script>
You may download the source code from github.
If you have any issues with this please report in on github.
If you'd like to contribute to this project, you can fork the project send a pull request.