This article mainly introduces to you the specific steps and related operation skills of switching tab tags in jquery. Friends in need can refer to it. I hope it can help everyone.
css
body { cursor:default; -webkit-text-size-adjust:none; font-size:12px; font-family:Arial; background:#FFF; } .clear { zoom:1; } .clear:after { visibility:hidden; display:block; font-size:0; content:"1"; clear:both; height:0; } .main { width:500px; margin:20px auto; } .btn span { width:35px; text-align:center; color:#fff; background:#f00; cursor:pointer; margin:0 5px; display:block; float:left; } .con { display:none; border:#033 1px solid; height:100px; width:200px; overflow: auto;}
html
<DIV class="main"> <DIV class="btn clear"> <span>1</span><span>2</span><span>3</span> </DIV> <DIV class="con"> 第一个<br />第一个<br />第一个<br />第一个<br />第一个<br />第一个<br />第一个<br />第一个<br />第一个<br />第一个<br />第一个<br />第一个<br />第一个 </DIV> <DIV class="con">第二个<br /> </DIV> <DIV class="con">第三个<br /> </DIV> </DIV>
js
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script type="text/javascript">$(".con").eq(0).show(); $(".btn span").click(function() { var num = $(".btn span").index(this); $(".con").hide(); $(".con").eq(num).show().slblings().hide(); }) </script>
The above is the detailed content of Switching tab labels in jquery. For more information, please follow other related articles on the PHP Chinese website!