1. 程式人生 > >jQuery動畫連續觸發、滯後反覆執行解決辦法

jQuery動畫連續觸發、滯後反覆執行解決辦法

<style type="text/css">
li{
background-image: url(images/case_back_03.png);
background-repeat: no-repeat;
width: 200px;
height: 200px;
background-size: 100%;
}
</style>

<body>

<ul>
<li></li>
<li></li>
<li></li>
</ul>

</body>

<script>

$("li").hover(function(){
$(this).stop().animate({"background-size":"110%"},500);
});
$("li").mouseout(function(){
$("li").stop().animate({"background-size":"100%"},500);
});
</script>



stop()-----停止當前動畫,繼續下一個動畫