How do I have two effects in jQuery run in sequence
, not simultaneously? Take this piece of code for example:
$("#show-projects").click(function() {
$(".page:visible").fadeOut("normal");
$("#projects").fadeIn("normal");
});
The fadeOut
and the fadeIn
run simultaneously, how do I make them run one after the other?
You can supply a callback to the effects functions that run after the effect has completed.
$("#show-projects").click(function() {
$(".page:visible").fadeOut("normal", function() {
$("#projects").fadeIn("normal");
});
});
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