如果我需要一个接一个地调用这个函数,
$('#art1').animate({'width':'1000px'},1000);
$('#art2').animate({'width':'1000px'},1000);
$('#art3').animate({'width':'1000px'},1000);
Run Code Online (Sandbox Code Playgroud)
我知道在jQuery中我可以做类似的事情:
$('#art1').animate({'width':'1000px'},1000,'linear',function(){
$('#art2').animate({'width':'1000px'},1000,'linear',function(){
$('#art3').animate({'width':'1000px'},1000);
});
});
Run Code Online (Sandbox Code Playgroud)
但是,我们假设我没有使用jQuery而且我想调用:
some_3secs_function(some_value);
some_5secs_function(some_value);
some_8secs_function(some_value);
Run Code Online (Sandbox Code Playgroud)
我应该如何调用这个函数来执行some_3secs_function,然后在该调用结束后,然后执行some_5secs_function并在该调用结束后再调用some_8secs_function?
更新:
这仍然无效:
(function(callback){
$('#art1').animate({'width':'1000px'},1000);
callback();
})((function(callback2){
$('#art2').animate({'width':'1000px'},1000);
callback2();
})(function(){
$('#art3').animate({'width':'1000px'},1000);
}));
Run Code Online (Sandbox Code Playgroud)
三个动画同时开始
我的错误在哪里