Javascript jQuery阻止stop()为元素指定固定高度
我有以下几行代码:Javascript jQuery阻止stop()为元素指定固定高度,javascript,jquery,Javascript,Jquery,我有以下几行代码: $(".product-list .product").hover(function() { $(this).find('.product-description').stop().slideDown("slow"); }, function() { $(this).find('.product-description').stop().slideUp("slow"); }) 现在的问题是,当我移动得足够快,然后再次将元素悬停时,.product描述会停留在
$(".product-list .product").hover(function() {
$(this).find('.product-description').stop().slideDown("slow");
}, function() {
$(this).find('.product-description').stop().slideUp("slow");
})
现在的问题是,当我移动得足够快,然后再次将元素悬停时,.product描述会停留在旧事件的高度
例如:
谢谢你的建议试着像下面那样使用它
$(".product-list .product").hover(function() {
$(this).find('.product-description').stop(true, true).slideDown("slow");
}, function() {
$(this).find('.product-description').stop(true, true).slideUp("slow");
})
停止([clearQueue][,jumpToEnd])
clearQueueA布尔值,指示是否将排队的动画作为
好。默认为false
jumpToEndA布尔值,指示是否完成当前
立即播放动画。默认为false
+谢谢-我已经找到了解决方案,但我不喜欢这样:)@Lumio,我可以问你为什么不喜欢吗?在我看来,这是清除动画队列的正确方法是的,这将是一个解决方案,但我不喜欢它的跳跃方式。@Lumio试着设置一个小提琴,让我们可以看一看。