I've done some easy .hover(function() statement in jQuery. When i hover over a text i simply want a #div.fadeIn, and on non-hover fadeOut. It works. But it's just if i spam the text-trigger with hover and un-hoverring really quickly and then stop the animation begin to give a blinking effect. It just kind of loops, really annoying!
+2
A:
There are a few easy ways to fix this, but this one should provide a nice effect for what you want:
$("#yourtrigger").hover(function(){
$("#div").stop(true).fadeTo( "fast", 1.0);
}, function(){
$("#div").fadeOut( "fast" );
});
Its important not to use fadeIn
with this method as it will stop fading after a while because of how jQuery tracks what it should "fade in to".
Doug Neiner
2010-02-08 20:24:14
Thank you, Doug, its working great!
Mattias Alfborger
2010-02-09 14:53:52
A:
If you have something like this:
$('#your_div').action1().action2();
Change it to:
$('#your_div').action1(miliseconds, function() {
$(this).action2();
});
You can even, with v1.4, add the delay() call like this.
$('your_div').action1().delay(miliseconds).action2();
tsenart
2010-02-08 20:25:12