jQuery 导致浏览器崩溃
我正在尝试使用 jQuery 开发游戏。它会使用 jQuery 动态创建一些 div 并删除不必要的 div,但一段时间后我的浏览器变得很重并使用大量进程并崩溃。
如果刷新我的页面,我又可以玩游戏一段时间了。
除了这个剩余的功能工作正常..
有什么问题吗? 怎么解决呢?
I'm trying to develop a game using jQuery. it will create some div's dynamically using jQuery and also removing unnecessary div's, but after some time my browser going heavy and using lot of process and getting crashed.
If refresh my page, again I'm able to play the game for some time.
Except this remaining functionality working fine..
What is the problem?
How to solve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 FireFox 的 Web 开发人员和/或 Firebug 插件等工具来查看您的 HTML 实时情况以及您可能遇到的 JS 问题。
Use something like the web developer and/or firebug add on for FireFox to see what is happening to your HTML live and what JS problems you may be having.
我认为 Chrome Web 开发者工具将帮助你解决这个问题。
打开工具(Ctrl+Shift+J)->个人资料 -> CPU Profiles
你会发现哪个进程(函数)花费了太多时间。尝试一下:-)
I think Chrome Web developer Tools will help u to solve the problem.
open the tool( Ctrl+Shift+J ) -> Profiles -> CPU Profiles
you will find which process( function ) cost too much time. have a try :-)
你可以尝试display:hidden,如果dom不显示,则不需要浏览器渲染它。
You can try display:hidden, if the dom doesn't show up, it won't need the browser to render it.