多个jquery动画完成回调
函数如下所示,我使用jquery动画函数try,但我认为css转换也可以做到这一点:) 每个动画项目都有延迟时间,如何检测是否所有动画项目都已淡出并进行回调 我在想 手动设置更长的功能延迟时间可能会工作,但它是手动的:( 获取动画项目的最大数据延迟时间,并自动设置函数延迟可能更好 还是其他聪明的方法 非常感谢:)试试看多个jquery动画完成回调,jquery,animation,callback,Jquery,Animation,Callback,函数如下所示,我使用jquery动画函数try,但我认为css转换也可以做到这一点:) 每个动画项目都有延迟时间,如何检测是否所有动画项目都已淡出并进行回调 我在想 手动设置更长的功能延迟时间可能会工作,但它是手动的:( 获取动画项目的最大数据延迟时间,并自动设置函数延迟可能更好 还是其他聪明的方法 非常感谢:)试试看 $('a')。在('click',function(){//单击菜单 var len=$('.animate_item')。长度; $('.animate_item')。每个(
$('a')。在('click',function(){//单击菜单
var len=$('.animate_item')。长度;
$('.animate_item')。每个(函数(i,el){
//很多动画项目开始淡出,
//html值数据延迟的延迟时间
$(this).fadeOut($(this).data(“延迟”),function(){
如果(i==len-1){
控制台日志(“abc”)
//做事
}
//设置所有淡出项的动画后,
//还有很多动画项目fadein
//$('.other_animate_item')。每个(函数(){
//$(this).fadeIn(淡入淡出延迟);
// });
});
});
});代码>
点击
A.
B
c
可以包括html
?预期结果是什么?你的答案是:)谢谢
$('a').on('click', function() { // click menu
$('.animate_item').each(function() {
$(this).fadeOut(fade_out_delay, function(){ // alot of animate_item start fadeout, delay time from html value data-delay
$('.another_animate_item').each(function() { // after animate_item all fadeout, alot of another_animate_item fadein
$(this).fadeIn(fade_in_delay);
});
});
});
});