响应式tab,支持关闭某个项目,自动循环打开
XML/HTML Code
- <div id="horizontalTab">
- <ul>
- <li><a href="#tab-1">Responsive Tab-1</a></li>
- <li><a href="#tab-2">Responsive Tab-2</a></li>
- <li><a href="#tab-3">Responsive Tab-3</a></li>
- <li><a href="#tab-4">Responsive Tab-4</a></li>
- <li><a href="#tab-5">Responsive Tab-5</a></li>
- </ul>
- <div id="tab-1">
- <p>freejs.net</p>
- </div>
- <div id="tab-2">
- <p>各种下拉菜单,导航,多级菜单,右侧展开,左侧展开</p>
- </div>
- <div id="tab-3">
- <p>tab标签,选项卡,选卡,jquery选项卡,标签页,动态加载tab</p>
- </div>
- <div id="tab-4">
- <p>翻页,分页,无刷新翻页,jquery翻页 本站演示中的分页数据库结构都一样的</p>
- </div>
- <div id="tab-5">
- <p>jquery文字特效,js文字特效,包括一些其他js库的,例如mootools</p>
- </div>
- </div>
- <p><button id="start-rotation">Start Rotation</button> <button id="stop-rotation">Stop Rotation</button> </p>
- <p>
- <button class="select-tab" value="0">1</button>
- <button class="select-tab" value="1">2</button>
- <button class="select-tab" value="2">3</button>
- <button class="select-tab" value="3">4</button>
- <button class="select-tab" value="4">5</button>
- <p>
- <p><button id="enable-tab">Enable Tab 4</button> <button id="disable-tab">Disable Tab 4</button> </p>
- <p class="info"></p>
- <!-- jQuery with fallback to the 1.* for old IE -->
- <!--[if lt IE 9]>
- <script src="js/jquery-1.11.0.min.js"></script>
- <![endif]-->
- <!--[if gte IE 9]><!-->
- <script src="js/jquery-2.1.0.min.js"></script>
- <!--<![endif]-->
- <!-- Responsive Tabs JS -->
- <script src="js/jquery.responsiveTabs.js" type="text/javascript"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- var $tabs = $('#horizontalTab');
- $tabs.responsiveTabs({
- rotate: false,
- startCollapsed: 'accordion',
- collapsible: 'accordion',
- setHash: true,
- disabled: [3,4],
- activate: function(e, tab) {
- $('.info').html('Tab <strong>' + tab.id + '</strong> activated!');
- },
- activateState: function(e, state) {
- //console.log(state);
- $('.info').html('Switched from <strong>' + state.oldState + '</strong> state to <strong>' + state.newState + '</strong> state!');
- }
- });
- $('#start-rotation').on('click', function() {
- $tabs.responsiveTabs('startRotation', 1000);
- });
- $('#stop-rotation').on('click', function() {
- $tabs.responsiveTabs('stopRotation');
- });
- $('#start-rotation').on('click', function() {
- $tabs.responsiveTabs('active');
- });
- $('#enable-tab').on('click', function() {
- $tabs.responsiveTabs('enable', 3);
- });
- $('#disable-tab').on('click', function() {
- $tabs.responsiveTabs('disable', 3);
- });
- $('.select-tab').on('click', function() {
- $tabs.responsiveTabs('activate', $(this).val());
- });
- });
- </script>
原文地址:http://www.freejs.net/article_tabbiaoqian_532.html