响应式Tabs选项卡 PC端垂直显示,移动端水平显示
XML/HTML Code
- <div class="tabs-vertical">
- <ul>
- <li> <a class="tab-active" data-index="0" href="#">导航菜单</a> </li>
- <li> <a data-index="1" href="#">TAB标签</a> </li>
- <li> <a data-index="2" href="#">分页</a> </li>
- </ul>
- <div class="tabs-content-placeholder">
- <div class="tab-content-active">
- <p>各种下拉菜单,导航,多级菜单,右侧展开,左侧展开</p>
- </div>
- <div>
- <p>tab标签,选项卡,选卡,jquery选项卡,标签页,动态加载tab</p>
- </div>
- <div>
- <p>翻页,分页,无刷新翻页,jquery翻页 本站演示中的分页数据库结构都一样的 </p>
- </div>
- </div>
- </div>
JavaScript Code
- <script type="text/javascript">
- $(document).ready(function() {
- var widget = $('.tabs-vertical');
- var tabs = widget.find('ul a'),
- content = widget.find('.tabs-content-placeholder > div');
- tabs.on('click', function (e) {
- e.preventDefault();
- // Get the data-index attribute, and show the matching content div
- var index = $(this).data('index');
- tabs.removeClass('tab-active');
- content.removeClass('tab-content-active');
- $(this).addClass('tab-active');
- content.eq(index).addClass('tab-content-active');
- });
- });
- </script>
原文地址:http://www.freejs.net/article_tabbiaoqian_837.html