我有索引页面。在404页面上,我通过iframe插入了索引页面。对于计时器我使用以下代码:
var timer = setInterval(function () {methods._next(data,options)},3000);
$("#centralPanelBorder, #leftBlock, #rightBlock").hover(function () {
clearInterval(timer);
},
function () {
timer = setInterval(function () {methods._next(data, options)},3000);
})
此代码在索引页面上工作正常,但在iframe上 - methods._next加倍,如果我尝试悬停和取消 - 定时器不是删除,而是多重。怎么解决?感谢
UPD:已解决
答案 0 :(得分:0)
在this.timer
次回拨中将timer
更改为hover()'s
。
var timer = setInterval(function () {methods._next(data,options)},3000);
$("#centralPanelBorder, #leftBlock, #rightBlock").hover(function () {
clearInterval(timer);
},
function () {
timer = setInterval(function () {methods._next(data, options)},3000);
});