二级菜单动画下拉

效果:
在这里插入图片描述

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script> <!--js首先引外部在引内部-->
		<link rel="stylesheet" type="text/css" href="css/css.css" />
	</head>
	<body>
	
		<div class="nav">
			<ul>
				<li class="l1"><a href="##">导航1</a></li>
				<li class="l1"><a href="##">导航2</a>
					<ul id="mask">
						<li class="l2"><a href="##">公司简介</a></li>
						<li class="l2"><a href="##">公司文化</a></li>
						<li class="l2"><a href="##">资质荣誉</a></li>
					</ul>
				</li>
				<li class="l1"><a href="##">导航3</a></li>
				<li class="l1"><a href="##">导航4</a>
					<ul>
						<li class="l2"><a href="##">公司简介</a></li>
						<li class="l2"><a href="##">公司文化</a></li>
						<li class="l2"><a href="##">资质荣誉</a></li>
					</ul>
				</li>
				<li class="l1"><a href="##">导航5</a></li>
				<li class="l1"><a href="##">导航6</a></li>
				<li class="l1"><a href="##">导航7</a></li>
				<li class="l1"><a href="##">导航8</a></li>
				<div class="clear"></div>
			</ul>
		</div>
		<!-- nav -->
		
	</body>
 	<script type="text/javascript" src="js/js.js"></script>
</html>

css:

.clear{
	clear: both;
}
ul, li,a{
	list-style: none;
	text-decoration: none;
	margin: 0;
	padding: 0;
}
.nav{
	width: 100%;
	height: 3em;
	/*background-color: #333;*/
	margin-top: 2em;
}
a{
	display: block;
	width: 6em;
	height: 1.5em;
	text-align: center;
	padding-top: 0.5em;
	color: white;
}
ul{
	width: 48.8em;
	margin: 0 auto;
	background-color: #333;
}
ul li{
	float: left;
	border-right: 0.1em white solid;
	position: relative;
}
ul li ul{
	position: absolute;
	width: 6em;
	height: 0;
	overflow-y: hidden;
/*	display: none;*/
}
/*ul li:hover ul{
	display: block;
}*/

js:

$(function(){
	$("ul .l1").hover(function(){
		$(this).find("ul").animate({
			height:"114px"
		},300);
	},function(){
		$(this).find("ul").animate({
			height:"0"
		},300);
	});
});

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值