Skip to content Skip to sidebar Skip to footer

How To Fire A Callback Function After A For-loop Is Done In Jquery?

I have two functions that caluclate and adjust the height and width of elements on screen. panelHeight sets the height of target elements to the available screen height, while pane

Solution 1:

This is the purpose of the JQuery Deferred...

var deferred = $.Deferred();

somethingAsync(function() {
    // callback stuff here// now tell the deferred task it's ok to proceed
    deferred.resolve();
}

deferred.done(function() {
    // your finalize code here
});

Edit Since the resolve event needs to be tied to a dom resizing, maybe the Javascript resize event handler would work.

Post a Comment for "How To Fire A Callback Function After A For-loop Is Done In Jquery?"