Reputation: 3081
I have two problems with my Jquery hover effects.
I need something like if(background is visible && mouse not in div element ) then play mouse-out animation. (reset cover logo)
Upvotes: 4
Views: 4173
Reputation: 105029
I've changed JSfiddle to use latest jQuery library, and changed bounce animations to simple fades... And it seems to work as expected.
I suppose your bounce effects (provided by jQuery UI) may be the culprit that prevent correct stopping in some way.
Use simple transitions if you need to and if possible move animations out of your event handlers with deferred execution so fast hovering will not fire any transition animations. That is likely the best way to ensure that all your mouse events are properly handled and recorded.
Upvotes: 4
Reputation: 1313
It might be a problem with the animation queue. Check the jQuery's stop method. The example in the official documentation will help you http://api.jquery.com/stop/ .
As the doc suggest, updating to jQuery version to > 1.7 might be required. If you cannot use an updated jQuery version, AND you are changing opacity you must set the opacity to 0 / 1 instead of using fadeIn fadeOut. Ex:
$el.bind('mouseenter',function(){
$(this).stop().animate({
opacity: 1
});
}).bind('mouseleave',function(){
$(this).stop().animate({
opacity: 0
});
Upvotes: 1