一、如果用到jQuery的動畫
在animate前加上 $(obj).stop(true,true)
$(obj).stop(true,true).animate()
二、通過瀏覽器窗口焦點事件,定時清掉定時器
window .onfocus=function(){
timer=setInterval(autoRun,1000);
}
setTimeOut(() =>{
clearInterval(timer);
}){
一、如果用到jQuery的動畫
在animate前加上 $(obj).stop(true,true)
$(obj).stop(true,true).animate()
二、通過瀏覽器窗口焦點事件,定時清掉定時器
window .onfocus=function(){
timer=setInterval(autoRun,1000);
}
setTimeOut(() =>{
clearInterval(timer);
}){
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。