Thursday, April 25, 2024
 Popular · Latest · Hot · Upcoming
147
rated 0 times [  148] [ 1]  / answers: 1 / hits: 18633  / 16 Years ago, wed, february 18, 2009, 12:00:00

So what I want to do is to coordinate some effects using jQuery for some AJAX calls that I'm working with. My problem is that the fadeIn for the second div fires at the same time with the fadeOut for the first div.



This could apply to other events as well so I'm curious, is there any way to make fadeId launch ONLY after fadeOut is done ?



jQuery(#div1).fadeOut(slow); 
jQuery(#div2).fadeIn(slow);


Thanks


More From » jquery

 Answers
8

You can do this by using a callback. Check out the jQuery docs.



jQuery(#div1).fadeOut(slow, function() { jQuery(this).fadeIn('slow'); }); 


Pretty much all of the jQuery effects take a callback to execute after the effect is over.


[#99956] Tuesday, February 10, 2009, 16 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
armandoh

Total Points: 208
Total Questions: 94
Total Answers: 112

Location: South Sudan
Member since Sun, Jul 11, 2021
3 Years ago
armandoh questions
Wed, Apr 13, 22, 00:00, 2 Years ago
Sat, Jan 30, 21, 00:00, 3 Years ago
Fri, Jun 5, 20, 00:00, 4 Years ago
Sun, Dec 22, 19, 00:00, 4 Years ago
;