為什么clearInterval要使用兩次?
aA[i].onmouseover=function(){ ????var?This=this; ????clearInterval(This.time); ????This.time=setInterval(function(){ This.style.width=This.offsetWidth+8+"px"; if(This.offsetWidth=160) ????clearInterval(This.time); ????},30) }
為什么在if判斷中不會停止?
2016-10-19
第一個?clearInterval(This.time)是為了防止動作累加,第二個是清除當(dāng)前動作。if語句的意思是,當(dāng)長度到160px的時候,清除動作。interval是定時器。