如何給間歇行滾動添加鼠標移入移出事件
area.onmouseover = function () {
? ? ? ? ? ? clearInterval(time); ? ? ?
? ? }
? ? area.onmouseout = function () {
? ? ? ? ? ? time = setInterval(startScroll,20);
? ? ? ? }
單獨加入mouseover是可以執行的,但是加入mouseout之后就會出現bug,不停的滾動,請問是怎么回事呢
area.onmouseover = function () {
? ? ? ? ? ? clearInterval(time); ? ? ?
? ? }
? ? area.onmouseout = function () {
? ? ? ? ? ? time = setInterval(startScroll,20);
? ? ? ? }
單獨加入mouseover是可以執行的,但是加入mouseout之后就會出現bug,不停的滾動,請問是怎么回事呢
2016-09-26
舉報
2016-10-21
移除時間里要先清除定時器,這樣應該能解決
area.onmouseover=function(){
clearInterval(time);
clearTimeout(t);
}
area.onmouseout=function(){
clearInterval(time);
time=setInterval("scrollUp()",speed);
}
2016-09-27
setInterval('startScroll()','20')