我已經做了四span
其上mouseOver
動畫到top:20px
和mouseOut
動畫回top:-20px
。停止下一個動畫開始前一個動畫的JQuery的
我寫了這個代碼:
$(".pull_down").mouseover(function(){
$(this).animate({top:'20px'});
});
$(".pull_down").mouseout(function(){
$(this).animate({top:'-20px'});
});
所有span
具有相同的類pull_down
具有這種CSS style
:
.pull_down
{
-webkit-msie-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
background:#900;
color:#FFF;
font-size:20px;
text-transform:capitalize;
font-weight:bold;
padding:5px;
position:absolute;
border:#000 solid 2px;
border-bottom-left-radius:10px;
padding-right:100px;
z-index:500;
width:100px;
}
.pull_down:hover
{
cursor:pointer;
}
基本上這是沒有用的。
的問題就在這裏,如果鼠標越過這些元素超過1次,說7次,那麼這些動畫排隊,這看起來很笨拙
所以,我想要的是,當我徘徊在一段範圍內它開始動畫,當我切換另一個範圍時,最後一個範圍恢復到它的位置。
一個例子是here
我也看了相關的帖子爲.stop(),但無法弄清楚如何做到這一點。