Can someone explain why this won’t work?
jQuery('.right-et-tooltip').delay(800).mouseout(function(){
jQuery(this).find('.right-et-tooltip-box').animate({ opacity: 'hide', left: '-100px' }, 30);
});
I get no delay at all. Just as soon as the mouse is out, BOOM it goes away.
Thanks, I have tried a few things, so just frustrated.
Your delay is doing absolutely nothing because it’s bound to the jQuery selector and not to the function within the
mouseouthandler.Try this instead…
Your jsFiddle with the correction applied…
http://jsfiddle.net/zGtBN/2/
EDIT (a side note):
It would be much better to use the
mouseenter&mouseleavemethods rather than themouseover&mouseoutmethods which tend to cause a rapid blinking effect during the time your mouse is hovering.Then you can simply combine the
mouseenterandmouseleavehandlers into one by using the jQuery.hover()method.Your same exact two functions insterted into a
.hover()method here…http://jsfiddle.net/zGtBN/3/
EDIT 2:
When you re-enter before the leave animation completes, the animations will queue up. If you enter & leave really fast several times, you’ll have all those animations to blink on/off before they stop.
To prevent the animation queue from stacking up and creating a new issue where it comes on/off because of the
mouseleavedelay, use a jQuery.stop(true, false)on themouseenterfunction like this…Upon
mouseenter, it stops anymouseleaveanimation immediately. Thetrueon the “clearQueue” option clears out the animation queue and thefalseon the “jumpToEnd” option says to stop the current animation instead of completing it immediately.Modified demo…
http://jsfiddle.net/zGtBN/4/