.defer(5000)
在JavaScript中导致too much recursion
错误。我如何延迟执行5秒?如何在JavaScript中延迟
rotate: function() {
if (!paused) {
this.show(counter);
counter = counter + 1;
if (counter === Spire.Rotator.data.items.length) {
counter = 0;
}
Spire.Rotator.rotate().defer(5000);
//$.proxy(Spire.Rotator.rotate, Spire.Rotator).defer(delay);
}
}
不要使用字符串作为setTimeout的参数。这是有效的,但容易引用地狱,也很慢。改用一个函数:'setTimeout(Spire.Rotator.rotate,5000)' – slebetman 2010-11-19 03:20:04
@slebetman啊!当然是。感谢您的提醒。 :) – Alex 2010-11-19 03:21:35