如何阻塞javascript运行的线程?
可能的重复:
在 Javascript 中休眠
如何阻止执行随机的毫秒数来执行 fadeIn
在几个 div 上将它们按顺序一个接一个地弹出在屏幕上,但优雅地出现有点像谷歌顶部菜单在搜索框渲染后几乎没有返回?
Possible Duplicate:
Sleep in Javascript
How can I block the execution for random amount of milliseconds to say do the fadeIn
on several divs to pop them up on the screen one after the other, in sequential order, but appearing gracefully kinda like google top menu comes back little after the search box is rendered?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将函数和延迟传递给
setTimeout
,但你不能在 JavaScript 中强制线程“睡眠”。You can pass a function and a delay to
setTimeout
, but you can't force a thread to "sleep" in JavaScript.