【发布时间】:2012-07-25 23:23:18
【问题描述】:
我有一个调用两个动画动作的事件监听器。不幸的是,它们的开始有少量错开(例如,函数中的第一个先开始)。
有人知道正确同步它们的方法吗?
这是我的代码:
$("#nav ul li a").hover(
function(){
$(lastBlock).children("div").animate({width: "0px"}, { queue:false, duration:400, easing:"swing" });
$(this).children("div").animate({width: maxWidth+"px"}, { queue:false, duration:400, easing:"swing"});
lastBlock = this;
}
);
因为第一个动画在第二个之前运行,它会导致整体宽度暂时变得不相等,这看起来有点时髦。
【问题讨论】:
标签: javascript jquery animation