【发布时间】:2014-04-02 09:50:37
【问题描述】:
我有结构
$('.qwe').click(function(){
$.when(
$('#q1').animate({top: 100}, 1000),
$('#q2').animate({top: 200}, 500)
).then(function () {
$('#q3').fadeOut();
});
});
它可以按我的需要工作,但我想在其他功能中取出动画:
function asd(){
$('#q1').animate({top: 100}, 1000);
$('#q2').animate({top: 200}, 500);
}
$('.qwe').click(function(){
$.when(asd()).then(function () {
$('#q3').fadeOut();
}
);
});
为什么动画同时执行?
【问题讨论】:
标签: jquery callback jquery-animate