0
我有这样的代码:为什么jQuery mouseenter /离开动画两次?
$(document).ready(function(){
$('.first').mouseenter(function(){
$(this).animate({
top: '115px'
}, 500);
});
$('.first').mouseleave(function(){
$(this).animate({
top: '127px'
}, 500);
});
});
当我运行我的。首先DIV上升和下降至少两次,如果不是更多,我不知道这可能是为什么。
感谢
当你改变顶部时,div移动得足够远吗? e鼠标离开div区域? –
你需要向我们展示dom :) –
你应该在这个实例中停止()这个动画队列,然后再添加一个新的动画。 '$(this).stop()。animate(...' – Shmiddty