我有一段程序在页面加载的时候,如下《代码A》设置了一个setInterval: sliderIntervalID = setInterval(function(){
if(active===false) {animate("next",true);}
},o.autoStart);然后在鼠标点击时间中用clearInterval(sliderIntervalID);取消了设置的定时器。
那么在鼠标再次点击后,怎么重新恢复这个定时器的功能呢?我现在用《代码A》重新设置定时器,但是没起作用。是不是因为这个sliderIntervalID已经被停止了,如果不刷新页面就不能再使用它了?
if(active===false) {animate("next",true);}
},o.autoStart);然后在鼠标点击时间中用clearInterval(sliderIntervalID);取消了设置的定时器。
那么在鼠标再次点击后,怎么重新恢复这个定时器的功能呢?我现在用《代码A》重新设置定时器,但是没起作用。是不是因为这个sliderIntervalID已经被停止了,如果不刷新页面就不能再使用它了?
鼠标移入移出的代码如下: $(".slide",$t).hover(
function(){clearInterval(sliderIntervalID);},
function(){
sliderIntervalID = setInterval(function(){
if(active===false) {animate("next",true);}
},o.autoStart);
}
);
$(".slide",$t).hover(
function(){clearInterval(sliderIntervalID);},
function(){
sliderIntervalID = setInterval(function(){
if(active===false) {animate("next",true);}
},o.autoStart);
}
);