I'm trying to execute a specific function once some processes finished executing.
My specific example refers to a number of animate() methods after which I want to call another function, however this function should only be called once the animate() methods finished processing:
var testObject = {
methodOne : function(callbackMethod) {
$('#item').animate({ 'paddingLeft' : '20px'}, { duration: 200, queue: false });
$('#item2').animate({ 'paddingLeft' : '30px'}, { duration: 200, queue: false });
$('#item3').animate({ 'paddingLeft' : '40px'}, { duration: 200, queue: false });
testObject.callbackMethod();
},
run : function() {
alert('done');
}
};
$(function() {
testObject.methodOne(run);
});
Any idea how can I achieve this?