效果展示
2020-08-09_151202.png 2020-08-09_151225.png
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../jQuery/jquery-1.8.3.min.js"></script>
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
.cons{
width: 1200px;
position: relative;
left: 50%;
margin-left: -600px;
}
.nav{
width: 900px;
height: 70px;
}
ul{
list-style-type: none;
width: 900px;
height: 70px;
}
ul>li{
width: 300px;
height: 70px;
float: left;
}
ul>li>h3{
width: 300px;
height: 70px;
line-height: 70px;
text-align: center;
background-color: #00AAAA;
color: #FFFFFF;
}
ul>li>div{
width: 1196px;
height: 500px;
position: absolute;
left: 0px;
background-color: #4169E1;
display: none;
}
</style>
</head>
<body>
<div class="cons">
<div class="nav">
<ul>
<li>
<h3>111</h3>
<div>
div1
</div>
</li>
<li>
<h3>222</h3>
<div>
div2
</div>
</li>
<li>
<h3>333</h3>
<div>
div3
</div>
</li>
</ul>
</div>
</div>
<script>
$(function(){
$("ul>li").click(function(){
$(this).children("h3").css("background","#620816").end().children("div").css("display","block");
$(this).siblings().children("h3").css("background","#00AAAA").end().children("div").css("display","none");
})
})
</script>
</body>
</html>
网友评论