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
Post a Comment