老师我想把变幻菜单和三级菜单放一起,但是动了一级菜单后,后面的一起动了,怎样可以使一级菜单变化,二级菜单不变呀
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
*{
margin: 0px;
padding: 0px;
}
#menu{
background-color: #eee;
width: 600px;
height: 40px;
margin: 0 auto;
}
ul{
list-style: none;
}
ul li{
float: left;
line-height: 40px;
text-align: center;
position: relative;
}
a{
text-decoration: none;
color: #000;
display: block;
width: 90px;
}
a:hover{
color: #fff;
background-color: #666;
}
ul li ul li{
float: none;
border-left: none;
margin-top: 2px;
background-color: #eee;
}
ul li ul{
width: 90px;
position: absolute;
left: 0px;
top: 40px;
display: none;
}
#menu li a span{
display: none;
}
#menu li a:hover span{
display: block;
background-color: #dc4e1b;
color: white;
}
#menu li a:hover{
margin-top: -40px;
}
</style>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
$(function(){
$(".navmenu").mouseover(function(){
$(this).children("ul").show();
})
$(".navmenu").mouseout(function(){
$(this).children("ul").hide();
})
})
</script>
</head>
<body>
<div id="menu">
<ul>
<li><a href="#">首页<span>Home</span></a></li>
<li class="navmenu"><a href="#">课程大厅<span>Course</span></a>
<ul>
<li><a href="#">JavaScript</a></li>
<li><a href="#">jQuery</a></li>
</ul>
</li>
<li class="navmenu"><a href="#">学习中心<span>Learn</span></a>
<ul>
<li><a href="#">视频学习</a></li>
<li><a href="#">案例学习</a></li>
<li><a href="#">交流平台</a></li>
</ul>
</li>
<li><a href="#">经典案例<span>Example</span></a></li>
<li><a href="#">关于我们<span>About</span></a></li>
</ul>
</div>
</body>
</html>