二级菜单被div给遮住了_折叠式菜单项目

HTML代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>折叠式菜单3</title>
<link rel="stylesheet" type="text/css" href="menu.css"/>
<script src="jquery-1.12.4.js"></script>
</head>
<body>
<ul class="menu_list">
<li>
<p class="menu_head">目标管理</p>
<div class="menu_body">
<a href="">主题空间</a>
<a href="">项目任务</a>
<a href="">工作计划</a>
<a href="">日程事件</a>
<a href="">时间视图</a>
</div>
</li>
<li>
<p class="menu_head">会议管理</p>
<div class="menu_body">
<a href="">主题空间</a>
<a href="">会议安排</a>
<a href="">待开会议</a>
<a href="">已开会议</a>
<a href="">会议资源</a>
</div>
</li>
<li>
<p class="menu_head">知识社区</p>
<div class="menu_body">
<a href="">我的收藏</a>
<a href="">知识广场</a>
<a href="">文档中心</a>
<a href="">我的博客</a>
<a href="">文档库管理</a>
</div>
</li>
<li>
<p class="menu_head">我的工具</p>
<div class="menu_body">
<a href="">综合查询</a>
<a href="">通讯录</a>
<a href="">便签</a>
<a href="">计算器</a>
<a href="">万年历</a>
<a href="">常用链接</a>
</div>
</li>
</ul>
</body>
</html>CSS代码:

* {
padding: 0;
margin: 0;
}
ul {
list-style-type: none;
margin: 100px;
}
.menu_head {
width: 185px;
height: 47px;
line-height: 47px;
padding-left: 38px;
font-size: 17px;
color: #475052;
cursor: pointer;
border: 1px solid #e1e1e1;
position: relative;
margin: 0px;
font-weight: bold;
background: #f1f1f1 url(../img/pro_left.png) center right no-repeat;
}
.menu_list .current {
background: #f1f1f1 url(../img/pro_down.png) center right no-repeat;
}
.menu_body {
width: 223px;
height: auto;
overflow: hidden;
line-height: 38px;
border-left: 1px solid #e1e1e1;
backguound: #fff;
border-right: 1px solid #e1e1e1;
}
.menu_body a {
display: block;
width: 223px;
height: 38px;
line-height: 38px;
padding-left: 38px;
color: #777;
background: #fff;
text-decoration: none;
border-bottom: 1px solid #e1e1e1;
}

Js代码:

<script>//隐藏所有二级菜单
$('.menu_head +div').hide();//显示当前,隐藏其它
$('.menu_head').click(function () {
var flag=$(this).next('div');//设置当前菜单右侧图标样式
if (flag.is(':hidden')){
$(this).css('backgroundImage','url(img/pro_down.png)');
$(this).next('div').slideDown();
} else{
$(this).css('backgroundImage','url(img/pro_left.png)');
$(this).next('div').slideUp();
}
});
</script>

项目运行效果如下:

41417d9dc59fc6f78965acbac863cb67.png
https://www.zhihu.com/video/1232699655655821312
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值