jQuery好像有BUG啊
代码如下,我发现快速在各个导航栏中移动会出现动画重叠的现象。要怎么才能解决呢?求大神指教.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JS左右伸缩菜单</title>
<style>
*{
font-family: "Microsoft Yahei";
font-size: 16px;
margin: 0;
padding: 0;
}
ul{
list-style-type: none;
height: 50px;
border-bottom: 5px solid #f60;
padding-left:20px;
}
li{
float: left;
margin-top:20px;
}
a{
display: block;
text-decoration: none;
width: 120px;
background-color: #ccc;
margin-right: 1px;
text-align: center;
height: 30px;
line-height: 30px;
color:#233;
}
.selecte_a,a:hover{
background-color: #f60;
color:white;
font-size: 17px;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<script>
$(function(){
$("a").each(function(index){
$(this).hover(function(){
$(this).animate({
width: "+=30px"
},300)
},function () {
$(this).animate({
width: "-=30px"
},300)
})
})
})
</script>
</head>
<body>
<ul>
<li><a href="#" class="selecte_a">首 页</a></li>
<li><a href="#">新闻快讯</a></li>
<li><a href="#">产品展示</a></li>
<li><a href="#">售后服务</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</body>
</html>