我怎么能为所有setInterval()清除()? [英] How can I clearInterval() for all setInterval()?

查看:474
本文介绍了我怎么能为所有setInterval()清除()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在jQuery插件中调用的setInterval(),但是我想从我的主页面清除它,在那里我无法访问存储setInterval的变量。

I've got a setInterval() called in a jQuery plugin, but I want to clear it from my main page, where I don't have access to the variable that the setInterval was stored in.

有没有办法清除页面上的所有计时器?

Is there a way to clear all timers present on a page?

推荐答案

这可以清除所有间隔的逻辑之一...

This can be one of logic to clear all interval...

for (var i = 1; i < 99999; i++)
        window.clearInterval(i);

这篇关于我怎么能为所有setInterval()清除()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆