Tom*_*ght 7 javascript jquery animation
我有一个调用两个动画操作的事件监听器.不幸的是,他们的开始是少量交错(例如,函数中的第一个首先开始).
有谁知道正确同步它们的方法?
这是我的代码:
$("#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;
}
);
Run Code Online (Sandbox Code Playgroud)
因为第一个动画在第二个动画之前略微运行,所以它会导致整体宽度暂时不相等,看起来有点时髦.