jquery multiple callbacks to keep animation order -


its 2nd day using im sorry if theres obvious error here. im trying have 3 functions execute 1 after other on load event, 3rd callback function cancels out 2nd. allowed 3? if no whats way around it.

$j(window).ready(function() {          $j("#content").animate({         marginleft: parseint($j("#content").css('marginleft'),10) == 0 ?         $j("#content").outerwidth() : 0     },function(){         $j(".headerimg").slidetoggle(900);         },function(){         $j(".headertitleimg").slidedown(100);}     ); }); 

thank you.

you calling animate method 2 callback functions: animate(properties, callback, callback). documentation specifies use of 1 callback function, it's possible allows more. hoever, if does, second callback called when first returns, won't wait animation first started.

the solution make second function callback first functions slidetoggle call:

$j(window).ready(function() {       $j("#content").animate(     {       marginleft: parseint($j("#content").css('marginleft'),10) == 0 ?       $j("#content").outerwidth() : 0     },     function(){       $j(".headerimg").slidetoggle(         900,         function(){           $j(".headertitleimg").slidedown(100);         }       );     }   ); }); 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -