【发布时间】:2011-05-13 23:07:25
【问题描述】:
我有这段代码,它会在我正在开发的网站上滑动打开购物篮预览。如果用户悬停在它上面,它会保持打开状态,但我希望它在触发我的悬停回调之前有两秒钟的延迟。这是为了防止用户不希望鼠标离开篮子区域。
下面是我用来为篮子制作动画的代码:
$('.cart_button, .cart_module').hover(function(){
$(".cart_module").stop().animate({top:'39px'},{duration:500});
}, function(){
$('.cart_module').stop().animate({top: -cartHeight},{duration:500})
});
这是我尝试使用但没有影响的代码:
$('.cart_button, .cart_module').hover(function(){
$(".cart_module").delay().animate({top:'39px'},{duration:500});
}, function(){
$('.cart_module').delay().animate({top: -cartHeight},{duration:500})
});
【问题讨论】:
-
版本 1.4.2。什么都没有发生,没有任何延迟,我会将我尝试使用的代码添加到我的问题中。
标签: jquery jquery-animate delay