@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/