jquery简单菜单下拉导航

40 篇文章 0 订阅
39 篇文章 0 订阅
jquery简单菜单下拉导航代码如下:复制运行即可

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>简单导航菜单</title>
<script type="text/javascript" src="jquery.min.js"></script>
<style>
*{ margin:0; padding:0; list-style:none;}
#nav {
	margin: 0;
	padding: 0;
	list-style: none;
	border-left: 1px solid #d5dce8;
	border-right: 1px solid #d5dce8;
	border-bottom: 1px solid #d5dce8;
	border-bottom-left-radius: 4px;
	-moz-border-radius-bottomleft: 4px;
	-webkit-border-bottom-left-radius: 4px;
	border-bottom-right-radius: 4px;
	-moz-border-radius-bottomright: 4px;
	-webkit-border-bottom-right-radius: 4px;
	height: 50px;
	padding-left: 15px;
	padding-right: 15px;
	background: #edf3f7;
}
#nav li {
	float: left;
	display: block;
	background: none;
	position: relative;
	z-index: 999;
	margin: 0 1px;
}
#nav li a {
	display: block;
	padding: 0;
	font-weight: 700;
	line-height: 50px;
	text-decoration: none;
	color: #818ba3;
	zoom: 1;
	border-left: 1px solid transparent;
	border-right: 1px solid transparent;
	padding: 0px 12px;
}
#nav li a:hover, #nav li a.hover {
	background-color: #fff;
	border-left: 1px solid #d5dce8;
	border-right: 1px solid #d5dce8;
	color: #576482;
}
/* @group subnav */
#nav ul {
	position: absolute;
	left: 1px;
	display: none;
	margin: 0;
	padding: 0;
	list-style: none;
	-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	-o-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	padding-bottom: 3px;
}
#nav ul li {
	width: 180px;
	float: left;
	border-top: 1px solid #fff;
	text-align: left;
}
#nav ul li:hover {
	border-left: 0px solid transparent;
	border-right: 0px solid transparent;
}
#nav ul a {
	display: block;
	height: 20px;
	line-height: 20px;
	padding: 8px 5px;
	color: #666;
	border-bottom: 1px solid transparent;
	text-transform:  uppercase;
	color: #797979;
	font-weight: normal;
}
#nav ul a:hover {
	text-decoration: none;
	border-right-color: transparent;
	border-left-color: transparent;
	background: transparent;
	color: #4e4e4e;
}
</style>
<script type="text/javascript">
$(document).ready(function() {	
	$('#nav li').hover(function() {
		$('ul', this).slideDown(200);
		$(this).children('a:first').addClass("hover");
	}, function() {
		$('ul', this).slideUp(100);
		$(this).children('a:first').removeClass("hover");		
	});
	
	
});

</script>

</head>

<body>
<div class="wrap">
	<ul id="nav">
		<li><a href="#">Homepage</a></li>
		<li><a href="#">About the Mag</a>
			<ul>
				<li><a href="#">Company</a></li>
				<li><a href="#">Authors</a></li>
				<li><a href="#">Write for Us?</a></li>
				<li><a href="#">Advertising</a></li>
				<li><a href="#">Get in Touch</a></li>
			</ul>
		</li>
		<li><a href="#">Freebies</a>
			<ul>
				<li><a href="#">PSD</a></li>
				<li><a href="#">AI Vectors</a></li>
				<li><a href="#">Patterns</a></li>
				<li><a href="#">Icons</a></li>
			</ul>			
		</li>
		<li><a href="#">Tutorials</a>
			<ul>
				<li><a href="#">HTML5</a></li>
				<li><a href="#">CSS3</a></li>
				<li><a href="#">jQuery</a></li>
				<li><a href="#">PHP MySQL</a></li>
				<li><a href="#">Ruby on Rails</a></li>
			</ul>
		</li>
		<li><a href="#">Web Tools</a>
			<ul>
				<li><a href="#">Performance</a></li>
				<li><a href="#">Browser Testing</a></li>
				<li><a href="#">CMS Plugins</a></li>
				<li><a href="#">Cheat Sheets</a></li>
			</ul>
		</li>
		<li><a href="#">Originals</a>
			<ul>
				<li><a href="#">Website Design</a></li>
				<li><a href="#">Mobile</a></li>
				<li><a href="#">User Interface</a></li>
				<li><a href="#">Freelancing</a></li>
				<li><a href="#">Inspiration</a></li>
			</ul>
		</li>
	</ul>
</div>


</body>
</html>



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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值