@locrizak 的答案是正确的(+1)。这是因为.delay()
默认是效果队列,但是.hide()
没有参数的时候会隐藏选中的元素,没有任何效果,所以根本不涉及效果队列。
如果你想隐藏没有任何动画,只需使用setTimeout
:
$('.trigger').mouseleave(function() {
setTimeout(function () {
$('.copy .wrapper').hide();
}, 3000);
});
http://jsfiddle.net/mattball/93F3k/
最后一次编辑,我保证
//Show-Hide divs
var current;
$('.trigger').live('mouseenter', function() {
var id = current = $(this).data('code');
$('#' + id).show().siblings().fadeOut();
}).live('mouseleave', function() {
var id = $(this).data('code');
current = null;
setTimeout(function ()
{
if (current !== id) $('#' + id).hide(1);
}, 3000);
});
//Close button
$('.copy .wrapper span').live('click', function() {
$(this).closest('.wrapper').stop(true, true).fadeOut();
});
演示:http: //jsfiddle.net/mattball/b2ew5/