基于jquery的tab切换 js原理

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

基于jquery的tab切换 js原理

  2020-05-12 我要评论
html代码:
复制代码 代码如下:

<div class="details">
<ul class="tab"><li class="on" rel="a1"><b>个人资料</b></li><li rel="a2"><b>帐号维护</b></li><li rel="a3"><b>在来个</b></li><li></li></ul>
<dl id="a1">11111111111111111111111111111111
<https://img.qb5200.com/download-x/dl>
<dl id="a2" style="display:none">
22222222222222222222222222222222222
<https://img.qb5200.com/download-x/dl>
<dl id="a3" style="display:none">3333333333333333333333333333333333333
<https://img.qb5200.com/download-x/dl>
</div>

js代码:
复制代码 代码如下:

$(function(){
$(".tab>li").mouseover(function(){
$(".tab>li").removeClass("on");
$(this).addClass("on");
var target = $('#' + this.rel);
if (target.size() > 0) {
$('.details > dl').hide();
target.show();
} else {
alert('There is no such container.');
}
});
});

效果图:


打包下载地址

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们