Why does delay() work here:
$('#tipper').mouseout(function() {
$('#tip').delay(800).fadeOut(100);
});
But this fails to delay:
$('#tipper').mouseout(function() {
$('#tip').delay(800).css('display','none');
});
// EDIT – here’s a working solution
// EDIT 2 – some bugs fixed
$('#tipper').mouseleave(function() {
setTimeout( function(){
$('#tip').css({'display','none'});
},800);
});
delay()works with the animation (fx) queue. Changing a css property does not work via that mechanism, and thus is not affected by the delay directive.There is a workaround — you can inject the property change as a queued operation, like this:
Also, you should probably be using
.hide()instead of.css('display','none').Here’s a working example: http://jsfiddle.net/redler/DgL3m/