├── .jshintrc ├── README.md ├── LICENSE-MIT ├── params.json ├── .eslintrc ├── .jscsrc ├── js └── responsive-tabs.js └── index.html /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "bitwise" : true, 3 | "curly" : true, 4 | "eqeqeq" : true, 5 | "forin" : false, 6 | "latedef" : true, 7 | "newcap" : true, 8 | "noarg" : true, 9 | "noempty" : true, 10 | "undef" : true, 11 | "strict" : true, 12 | "trailing" : true, 13 | "evil" : false, 14 | "quotmark" : "single", 15 | "node" : true, 16 | "browser" : true, 17 | "sub" : true, 18 | "smarttabs" : true, 19 | "camelcase" : true, 20 | "maxparams" : 5, 21 | "unused" : "vars", 22 | 23 | "globals": { 24 | "module" : true, 25 | "require" : true, 26 | "define" : true, 27 | "before" : true, 28 | "beforeEach" : true, 29 | "describe" : true, 30 | "it" : true, 31 | "after" : true, 32 | "afterEach" : true 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Bootstrap Responsive Tabs 2 | ========================= 3 | 4 | This uses standard Bootstrap 3.0.0 css and js for the tabs and collapse accordion items. They are regular [tabs](http://getbootstrap.com/javascript/#tabs) at some screen sizes and [collapsible](http://getbootstrap.com/javascript/#collapse) components based on the Bootstrap [Responsive Utilities](http://getbootstrap.com/css/#responsive-utilities), which can be defined by editing one attribute in the javascript file. 5 | 6 | Demo and Documentation 7 | ====================== 8 | To view the demo and documentation visit http://openam.github.io/bootstrap-responsive-tabs/ 9 | 10 | Key features 11 | ============ 12 | - Uses standard bootstrap tab markup. 13 | - Collapsible component (accordion) is created with jquery. 14 | - Tabs and accordions are accessible via keyboard. 15 | - Supports multiple tab groups on a page, with or without each being responsive. 16 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Michael Tuttle 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /params.json: -------------------------------------------------------------------------------- 1 | {"name":"Bootstrap-responsive-tabs","tagline":"","body":"Bootstrap Responsive Tabs\r\n=========================\r\n\r\nThis uses standard Bootstrap 3.0.0 css and js for the tabs and collapse accordion items. They are regular [tabs](http://getbootstrap.com/javascript/#tabs) at some screen sizes and [collapsible](http://getbootstrap.com/javascript/#collapse) components based on the Bootstrap [Responsive Utilities](http://getbootstrap.com/css/#responsive-utilities), which can be defined by editing one attribute in the javascript file.\r\n\r\nDemo\r\n====\r\nTo view the demo visit http://openam.github.io/bootstrap-responsive-tabs/\r\n\r\nKey features\r\n============\r\n- Uses standard bootstrap tab markup.\r\n- Collapsible component (accordion) is created with jquery.\r\n- Tabs and accordions are accessible via keyboard.\r\n- Supports multiple tab groups on a page, with or without each being responsive.\r\n\r\nNotes\r\n=====\r\n- On load the first item in the accordion and tab views are set to active opened. However only the respective set will be show.\r\n- When the window is resized to change from accordion to tabs, the last tab that was opened will be opened even if a different accordion was selected.\r\n- Only tried in Chrome and Firefox, but it should work in IE as well.\r\n\r\nHow to use\r\n==========\r\n- Include bootstrap css and js.\r\n- Include responsive-tabs.js.\r\n- Setup tabs per the bootstrap documents.\r\n- Add a _responsive_ class to the _ul_ that is used to create the tabs.\r\n- Add a _responsive_ class to the _div_ that is used to create the tab-content.\r\n- Edit the responsive-tabs.js to set where you want to have collapse in place of tabs\r\n\r\n>__Note:__ The only difference from the standard bootstrap tab markup to the responsive markup is the addition of the responsive.\r\n\r\n```\r\n
\r\n\r\nThis 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
31 |To see the difference just resize the width of your window.
32 |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.85 | Fourth ... 86 |
87 |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.
139 | 141 | <ul class="nav nav-tabs responsive" id="myTab"> 142 | <li class="active"><a href="#home">Home</a></li> 143 | <li><a href="#profile">Profile</a></li> 144 | <li><a href="#messages">Messages</a></li> 145 | </ul> 146 | 147 | <div class="tab-content responsive"> 148 | <div class="tab-pane active" id="home">...content...</div> 149 | <div class="tab-pane" id="profile">...content...</div> 150 | <div class="tab-pane" id="messages">...content...</div> 151 | </div> 152 | 153 | <script type="text/javascript"> 154 | (function($) { 155 | fakewaffle.responsiveTabs(['xs', 'sm']); 156 | })(jQuery); 157 | </script>158 | 159 |
You may download the source code from github.
174 |If you have any issues with this please report in on github.
176 |If you'd like to contribute to this project, you can fork the project send a pull request.
178 | 179 |