希望快速提问/回答。 我在元素上设置了一些动画,它们对不同的类做了很多相同的事情。但是,当我快速鼠标移动和鼠标快速移动时,动画将“错误”并播放另一个“框架”(即,从头到尾再播放一次动画,即使只有例如我移动鼠标的3个实例进出对象)。
有没有人有任何关于如何阻止这种情况发生的解决方案,比如清除动画以便在光标离开对象后它不会发生?
$(document).ready(function(){
$("div.project").mouseenter(function(){
$(this).find("img").animate({width:'120%',height:'120%', left:'-20px',top:'-20px'},100)
$(this).find(".overlay-project1").animate({opacity: 0.9},"fast")
$(this).find(".overlay-project2").animate({opacity: 0.95},"fast")
$(this).find(".overlay-project3").animate({opacity: 0.95},"fast")
mouseenter.stop(true,true);
});
$("div.project").mouseleave(function(){
$(this).find("img").animate({width:'100%',height:'100%', left:'0px', top:'0px'},"fast")
$(this).find(".featured").animate({opacity:1},200)
$(this).find(".overlay-project1").animate({opacity: 0},"fast")
$(this).find(".overlay-project2").animate({opacity: 0},"fast")
$(this).find(".overlay-project3").animate({opacity: 0},"fast")
mouseleave.stop(true,true);
});
});