views:

41

answers:

1

Is there any way to freeze any jquery script functions while animation runs?

for example:

$('#some_div').append('some stuff');
$('some_another_tag').remove();
$('#modal_window').fadeIn(300);

etc etc, is there any way to process all that stuf in threads? Thank you

+1  A: 

I don't think there's a way to pause execution, but you can give fadeIn() a callback that'll run when the animation is complete:

$('#modal_window').fadeIn(300);
stuffToDoAfterFade();

becomes

$('#modal_window').fadeIn(300, function() {
    stuffToDoAfterFade();
});
twon33