<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>菜单栏</title>
<style>
*{
margin: 0;
padding: 0;
}
.box{
width: 400px;
height: 280px;
background-color: red;
margin: 50px auto;
border: 1px solid #000;
}
.box .menu{
width: 100%;
height: 100%;
background-color: gold;
list-style: none;
}
.box .menu>.level1{
width: 100%;
height: auto;
line-height: 40px;
list-style: none;
}
.box .menu>.level1>a.current{
background-color: green;
color: #0a0a0a;
text-decoration: none;
}
.box .menu>.level1>a{
display: inline-block;
background-color: gray;
width: 100%;
text-align: center;
text-decoration: none;
}
.box .menu>.level1>.level2{
width: 100%;
height: 160px;
background-color: white;
display: none;
float: left;
}
.box .menu>.level1:nth-of-type(1)>.level2{
display: block;
}
.box .menu>.level1>.level2 li{
width: 100%;
height: 40px;
list-style: none;
background-color: gainsboro;
text-align: center;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script>
$(function () {
$(".level1>a").click(function () {
$(this).addClass("current").next().show().parent().siblings().children("a").removeClass("current").next().hide();
return false;
});
});
</script>
</head>
<body>
<div class="box">
<ul class="menu">
<li class="level1">
<a href="#one" class="current">衬衫</a>
<ul class="level2">
<li>短袖衬衫</li>
<li>长袖衬衫</li>
<li>短袖衬衫</li>
<li>短袖衬衫</li>
</ul>
</li>
<li class="level1">
<a href="#one">卫衣</a>
<ul class="level2">
<li>开襟卫衣</li>
<li>开襟卫衣</li>
<li>开襟卫衣</li>
<li>开襟卫衣</li>
</ul>
</li>
<li class="level1">
<a href="#one">裤子</a>
<ul class="level2">
<li>短袖衬衫</li>
<li>裤子衬衫</li>
<li>短袖衬衫</li>
<li>裤子衬衫</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
$(".level1>a").click(function () {
$(this).addClass("current").next().show().parent().siblings().children("a").removeClass("current").next().hide();
return false;
});
$(".level1>a").click(function () {
$(this).addClass("current")
.next().show()
.parent().siblings().children("a").removeClass("current")
.next().hide();
return false;
});
$(this).addClass("current")
.show()
.fadeTo("mouseover")
.fadeTo("fast",1)
.unbind("click")
.click(function(){
//do something
});
$(this).addClass("current")
.childer("li").show().end()
.siblings().removeClass()
.children("a").hide();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有