【发布时间】:2012-12-17 01:15:06
【问题描述】:
我一直试图在元素的所有 .animate() 函数(包括延迟和缓动)完成后才触发函数。
我尝试了几种不同的方法,但都没有成功,有什么想法吗?
$("#inner_work").on("mouseenter", ".activeBox", function(){
var thisBox = $(this).attr('id');
$("#inner_work [class^='workBox_']").each(function(){
if($(this).attr('id') != thisBox){
$(this).stop().delay(randomEasing(200,800)).animate({
opacity:0
}, randomEasing(200,700));
} else {
$(this).stop().animate({
opacity:1
}, 'fast');
}
});
});
如何在所有动画完成后触发事件?
randomEasing就是这个功能让它随机交错
function randomEasing(from,to)
{
return Math.floor(Math.random()*(to-from+1)+from);
}
【问题讨论】:
标签: jquery animation random mouseenter easing