且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

重新启动setInterval

更新时间:2022-05-30 22:23:23

只需将 intervalID 设为全局变量,方法是将其声明为外部及以上所有函数。

Just make intervalID be global variable by declaring it outside and above all functions.

使用当前代码,其范围仅限于 $(文档).ready()方法所以它可能会导致你描述的问题。

With your current code its scope is limited to $(document).ready() method so it might cause the problem you describe.