首页 > 其他 > 详细

菜单的闭合案例

时间:2020-02-10 00:13:20      阅读:86      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>菜单的闭合</title>
<meta charset="UTF-8">
<script src="../day6/jquery-3.4.1.js"></script>
<script>
function show(self) {
$(self).next().removeClass(‘hide‘);
$(self).parent().siblings().children(‘.con‘).addClass(‘hide‘);

}

</script>
<style>
.menu{
height: 500px;
width:30%;
background-color: gainsboro;
float:left;
}
.content{
height: 500px;
width:70%;
background-color: rebeccapurple;
float:left;

}
.title{
line-height: 50px;
background-color: #425a66;
color:forestgreen;
}
.hide{
display:none;
}
</style>
</head>
<body>
<div class="outer">
<div class="menu">
<div class="item">
<div class="title" onclick="show(this)">菜单1</div>
<div class="con">
<div>111</div>
<div>222</div>
<div>333</div>
</div>
</div>
<div class="item">
<div class="title" onclick="show(this)">菜单2</div>
<div class="con hide">
<div>111</div>
<div>222</div>
<div>333</div>
</div>

</div>
<div class="item">
<div class="title" onclick="show(this)">菜单3</div>
<div class="con hide">
<div>111</div>
<div>222</div>
<div>333</div>
</div>
</div>
</div>
<div class="content"></div>
</div>
</body>
</html>

技术分享图片

菜单的闭合案例

原文:https://www.cnblogs.com/startl/p/12289460.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!