【发布时间】:2013-09-21 06:22:30
【问题描述】:
我有这样的事情:
var activityTextToggleTimerTwo = setInterval(function() {
active_users_text.toggleClass("active inactive bounce bounceOutUp")
var activityTextToggleTimerThree = setTimeout(function() {
active_users_text.toggleClass("active inactive bounce bounceOutUp");
}, 5000);
}, 25000);
我尝试像这样清除超时/间隔:
clearInterval( activityTextToggleTimerTwo );
clearTimeout( activityTextToggleTimerThree );
我得到一个例外:
Uncaught ReferenceError: activityTextToggleTimerThree is not defined
为什么?我也认为 activityTextToggleTimerThree 没有被清除..
谢谢
【问题讨论】:
-
你不能清除
activityTextToggleTimerThree,因为它是一个函数。
标签: javascript settimeout setinterval clearinterval