I have a series of jQuery functions to execute in a block. When they ALL are done, I need another function to be called. It seems a callback is the best way to do this. Here is my code.
function flipPage (x, callback) {
$("#view-1").animate({
width: x,
}, 500);
$("#view-2").animate({
width: browserWidth - x,
}, 500);
$("#iframe-2").animate({
left: -x,
}, 500);
$("#sweeper").animate({
left: x,
}, 500);
callback(function() {
alert("I'm Done.");
//do the next thing
}) ;
}
flipPage?.animate()?callback, so it'sundefined... which is not a function.