您的位置:首页 > Web前端 > JQuery

jquery 经典选项卡代码

2013-09-05 20:22 197 查看
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312" />
<title>经典选项卡</title>
<script type="text/网页特效" src="http://www.php100.com/网页特效lib/jquery/jquery.网页特效"></script>
<style type="text/css教程">
.tab{text-align:left;width:500px;border:#ccc 1px solid;margin:100px;}
.tab dt{border-bottom:#ccc 1px solid;height:25px;background:#f1f1f1;margin-bottom:-1px;height:25px;line-height:25px;}
.tab dt strong{padding:0 15px;color:#444;}
.tab dt a{display:inline-block;cursor:pointer;padding:0 10px;text-align:center;background:#f1f1f1;color:#000;}
.tab dt a.on{background:#fff;color:#333;font-weight:bold;border-bottom:1px solid #fff;border-right:1px solid #ccc;border-left:1px solid #ccc;}
.tab dd{padding:10px;height:200px;clear:both;}
</style>
</head>
<body>
<script type="text/网页特效">
$(function(){
var tabtitle = ".tab dl dt a";
var tabcontent = ".tab dl ul";
$(tabtitle + ":first").addclass("on");
$(tabcontent).not(":first").hide();
$(tabtitle).unbind("click").bind("click", function(){
$(this).siblings("a").removeclass("on").end().addclass("on");
var index = $(tabtitle).index( $(this) );
$(tabcontent).eq(index).siblings(tabcontent).hide().end().fadein("slow");
});
});
</script>
<div class="tab">
<dl>
<dt><strong>经典选项卡</strong><a>手机卖场</a><a>脚本之家</a><a>海澜男人</a><a>精品居家</a></dt>
<dd>
<ul>1111111111111111111111</ul>
<ul>www.jb51.net</ul>
<ul>333333333333333333333</ul>
<ul>444444444444444444</ul>
</dd>
</dl>
</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: