jquery waiting until function is done

Posted by matthewsteiner on Stack Overflow See other posts from Stack Overflow or by matthewsteiner
Published on 2010-04-24T21:22:17Z Indexed on 2010/04/24 21:23 UTC
Read the original article Hit count: 246

Filed under:
|
|

So, I set the closing function for simple modal as follows:

$.modal.defaults.onClose = function (dialog) {
    $.validationEngine.closePrompt(".formError",true);
    dialog.data.fadeOut('slow', function () {});
    dialog.container.fadeOut('slow', function () {});
    dialog.overlay.fadeOut('slow', function () {
    $.modal.close();
    }); 
}

The line where the validationengine closes prompts basically just makes some divs disappear. The problem is that I don't want things to start fading out until closePrompt() is complete. Is there a way to do that? Is the only way with a "callback"? I don't think it has that built in to the function. Any other way to do it?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about simplemodal