温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

[置顶]       最简单的tab切换

发布时间:2020-08-01 12:42:23 来源:网络 阅读:309 作者:873582595 栏目:web开发

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 class="main">
  <div class="btn clear"><span>1</span><span>2</span><span>3</span></div>
  <div class="con">第一个<br /> </div>
  <div class="con">第二个<br /> </div>
  <div class="con">第三个<br /> </div>
</div>

截图

[置顶]          最简单的tab切换

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI