我知道我应该使用 $(selector).stop().animate(); 在某个地方,但我不确定当你离开时如何停止滞后,并且非常快地打开它,它会继续动画。这是我的代码,如果你能告诉我要设置什么(请记住我是 jquery 的初学者)。
$(document).ready(function(){
var order = $('#order').mouseenter(function(){
$('#animateorder').animate({top: '+=5.5em'}, 'fast')
});
var order2 = $('#order').mouseleave(function(){
$('#animateorder').animate({top: '-=5.5em'}, 'fast')
});
});
$(document).ready(function(){
$('#contact').mouseenter(function(){
$('#animatecontact').animate({top: '+=5.5em'}, 'fast')
});
$('#contact').mouseleave(function(){
$('#animatecontact').animate({top: '-=5.5em'}, 'fast')
});
});