码迷,mamicode.com
首页 > 其他好文 > 详细

仿QQ下拉菜单

时间:2016-10-26 14:20:20      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:color   document   contain   doc   one   parent   html   css   over   

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="">
<meta name="keywords" content="">
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<title>仿QQ下拉菜单</title>
<style type="text/css">
*{
padding:0px;
margin:0px;
font-family: microsoft yahei;
}
.container{
margin: 20px;
border:1px solid #000;
width: 240px;
overflow: hidden;
}
li{
list-style: none;
}
.container li{
background: #63f7ff;
width: 240px;
color:#000;
font-size: 18px;
cursor:pointer;
line-height: 2em;
}
.container li span{
width: 0;
height: 0;
border-top: 5px solid transparent;
border-left: 10px solid #000;
border-bottom: 5px solid transparent;
display: inline-block;
margin: 0 10px;
}
.container li .down{
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 10px solid #000;
}
.small{

}
.small li{
background: #fff;
color:#000;
border:1px solid #ddd;
font-size: 16px;
padding-left: 30px;
}
.small li:hover{
background:#63f7ff;
}
.hide{
display: none;
}
.container ul .color{
background:#f7f794;
}
</style>
</head>
<script type="text/javascript">
$(document).ready(function() {
$(‘.container>ul>li‘).click(function(){
$(this).toggleClass(‘color‘);
$(this).find(‘span‘).toggleClass(‘down‘);
$(this).next().toggleClass(‘hide‘);
})
});

</script>

<body>
<div class="container">
<ul>
<li><span></span>我的好友</li>
<ul class="small hide">
<li>张三</li>
<li>张三</li>
<li>张三</li>
</ul>
<li><span></span>企业好友</li>
<ul class="small hide">
<li>李四</li>
<li>李四</li>
<li>李四</li>
</ul>
<li><span></span>黑名单</li>
<ul class="small hide">
<li>小二</li>
<li>小二</li>
<li>小二</li>
</ul>
</ul>
</div>

</body>
</html>

仿QQ下拉菜单

标签:color   document   contain   doc   one   parent   html   css   over   

原文地址:http://www.cnblogs.com/ll-taj/p/5999855.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!