tab标签可以展示指定项目,清除tab效果并重建
操作方法
- 01
- 02
<divclass="wrap"> <h2>Basic tabs example</h2> <divclass="set set-1"> <divclass="panel panel-1"> <h2>Panel 1</h2> <p><a href="/article_fenye_19.html">jquery 无刷新翻页</a> 本例与《jquery 翻页分页》的区别在于本例更实用,翻页数字太多的时候会隐藏中间的部分。数据库与《jquery 翻页分页》的数据库相同</p> <buttonclass="btn">Show tab 3</button> <buttonclass="destroy">Destroy</button> <buttonclass="apply">Apply</button> </div> <divclass="panel panel-2"> <h2>Panel 2</h2> <p>2</p> </div> <divclass="panel panel-3"> <h2>Panel 3</h2> <p>3</p> </div> <divclass="panel panel-4"> <h2>Panel 4</h2> <p>4</p> </div> </div> <h2>With callback on tab select</h2> <divclass="set set-2"> <divclass="panel panel-1"> <headerclass="heading">Panel 1</header> <p>1</p> <buttonclass="btn">Show tab 2</button> </div> <divclass="panel panel-2"> <headerclass="head">Panel 2</header> <p>2</p> </div> <divclass="panel panel-3"> <headerclass="h1">Panel 3</header> <p>3</p> </div> </div> </div> JavaScript Code <script> $(function() { $(".set-1").mtabs(); $(".set-2").mtabs({ tab_text_el: ".heading, .head, header", onTabSelect: function(idx) { console.log("Selected tab is: " + idx); }, onReady: function () { console.log('Set 2 ready!'); } }); $('.set-1 .panel-1 .btn').on('click', function(event) { $('.set-1').mtabs('show', 2); event.preventDefault(); }); $('.set-1 .panel-1 .destroy').on('click', function(event) { $('.set-1').mtabs('destroy'); event.preventDefault(); }); $('.set-1 .panel-1 .apply').on('click', function(event) { $('.set-1').mtabs(); event.preventDefault(); }); $('.set-2 .panel-1 .btn').on('click', function(event) { $('.set-2').mtabs('show', 1); event.preventDefault(); }); }); </script>