如何延迟5秒的function调用?
我希望widget.Rotator.rotate()之间延迟5秒之间的调用…我怎么做到这一点在jQuery中…它似乎像jQuery的delay()不会为此工作… 
您可以使用普通的JavaScript,这将在5秒后调用一次your_func:
 setTimeout(function() { your_func(); }, 5000); 
 如果你的函数没有参数,没有明确的接收者,你可以直接调用setTimeout(func, 5000) 
 还有一个我曾经使用的插件。 它有一个oneTime和everyTime方法。 
- jQuery的计时器插件
 var rotator = function(){ widget.Rotator.rotate(); setTimeout(rotator,5000); }; rotator(); 
要么:
 setInterval( function(){ widget.Rotator.rotate() }, 5000 ); 
要么:
 setInterval( widget.Rotator.rotate.bind(widget.Rotator), 5000 );