JS:
$(".con").eq(0).show(); $(".btn span").click(function(){ var num =$(".btn span").index(this); $(".con").hide(); $(".con").eq(num).show().slblings().hide(); })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; }HTML:
<div> <div><span>1</span><span>2</span><span>3</span></div> <div>First<br /> </div> <div>Second<br /> </div> <div>Second<br /> </div> <div>Third<br /> </div></div>
screenshot
The simplest tab switching example code above is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.