Pretty much as the question says, I have some code running on an interval:
$("#blah").fadeOut(2000);
$("#blah2").fadeIn(2000);
I'd like to fadeOut, then fadeIn, rather than have both going simultaneously. Is there an easy way?
The jQuery fadeOut() method is used to fade out a visible element. Syntax: $(selector). fadeOut(speed,callback);
stop(). animate({opacity:'100'}) combo is what allows any fadIn/fadeOut to restart based on your trigger.
The . fadeOut() method animates the opacity of the matched elements. Once the opacity reaches 0, the display style property is set to none , so the element no longer affects the layout of the page. Durations are given in milliseconds; higher values indicate slower animations, not faster ones.
$("#blah").fadeOut(2000);
$("#blah2").delay(2000).fadeIn(2000);
Or:
$("#blah").fadeOut(2000, function(){
$("#blah2").fadeIn(2000);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With