1、 在jq版本里每次在animate前加上 $(obj).stop(true,true); 可以解决
2、 方法二:
var timer=null;
window .onfocus=function(){
timer=setInterval(autoRun,1000);
}
window.onblur=function(){
clearInterval(timer);
}
本文提供了两种有效的方法来解决在使用jQuery进行页面元素动画时出现的冲突问题。第一种方法是在每次调用animate前加入停止当前动画的代码。第二种方法则是通过设置定时器实现窗口聚焦时自动运行动画。
1、 在jq版本里每次在animate前加上 $(obj).stop(true,true); 可以解决
2、 方法二:
var timer=null;
window .onfocus=function(){
timer=setInterval(autoRun,1000);
}
window.onblur=function(){
clearInterval(timer);
}
1678
632

被折叠的 条评论
为什么被折叠?
