用jquery的方法制作一个简单的导航栏
<!DOCTYPEhtml>
<html>
<head>
<metacharset="utf-8">
<title>学习导航栏的制作</title>
<scriptsrc="http://code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(document).ready(function(){
$(".div1").click(function(){
$(".div2").addClass("dlHover");
});
$(".div1").hover(function(){//第一个函数作为鼠标悬浮时执行的函数
$(this).addClass("bg");
},function(){//第二个函数作为鼠标离开时执行的函数
$(this).removeClass("bg");
$(".div2").removeClass("dlHover");
});
});
</script>
<style>
*{margin:0pxauto;padding:0px;text-align:center;}
ul{list-style:none;}
.div2{display:none;width:100px;border:1pxsolidgray;background:#00FFFF;}
.dlHover{position:absolute;z-index:9999;display:block;}
.div1{border:1pxsolidgray;width:100px;background-color:#999999;}
.bg{background-color:#1F9999;}
</style>
</head>
<body>
<divclass="div1">
<spanclass="span1">导航1</span>
<divclass="div2">
<ul>
<li><ahref="#">导航2</a></li>
<li><ahref="#">导航3</a></li>
</ul>
</div>
</div>
<h3>学习导航栏的制作</h3>
<p>这是一个简单的导航栏</p>
</body>
</html>热门推荐
6 保研的祝福语简短
10 年轻20岁祝福语简短
11 朋友结婚祝福语信息简短
12 女孩婚礼贺卡祝福语简短
13 30段点歌简短祝福语
14 虎年春节祝福语图文简短
15 写给后妈祝福语大全简短
16 简短回复生日祝福语
17 校长送毕业祝福语简短
18 毕业立体贺卡祝福语简短