Kim Johnson schrieb:
> I'm having a hard time getting functions to happen in
> the order I want them to. Specifically, I need the
> html of a div to be rewritten BEFORE it slides back
> down. I'm seeing the html change while the div is
> sliding up, which isn't what I'm looking for. Is there
> any way to force functions to finish before moving on?
> Synchronous-style...
> 
> -a div on the page is assigned to divTarget, and I'm
> positive it's finding the correct one)
> 
> -stuff holds the results of an ajax query: some basic
> HTML.
> 
> $(divTarget).slideUp("slow");
> $(divTarget).children("div.middle").html(stuff);
> $(divTarget).slideDown("slow");
> 
> *note: I know I could chain these, but am trying to
> get it to work first before fiddling with that ;)
> 
> thanks,
> -kim

You have to use callbacks which are provided for all of the animate 
functions:

var target = $(divTarget);
target.slideUp("slow", function() {
     target.children("div.middle").html(stuff);
     target.slideDown("slow");
});

I've saved the target in a variable to avoid creating a jQuery object 3 
times.


-- Klaus

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to