为什么我的网页会冻结?
我正在使用 jQuery 的加载函数加载网站的一部分。
一切都运行良好,除了自从我添加加载功能后,我的页面在加载过程中冻结了 3-4 秒。
我一直无法找出到底是什么原因造成的...有什么想法吗?
我的网页可以在此处找到。
谢谢!
I am loading a part of my site using jQuery's load function.
Everything works great, except for the fact that ever since I added the load function, my page freezes for 3-4 seconds during the loading.
I have been unable to find out what is causing this exactly... Any ideas?
My webpage can be found here.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能还有其他问题,但我在 FireBug 中注意到的第一件事是你有一个脚本错误:
jQuery 未定义:
jQuery(this).css('marginLeft', -width/2);
这似乎来自 selectToUISlider.JQuery.js
我会首先解决这个问题,看看你是否仍然挂起。可能不相关,但很难判断,因为存在现有脚本错误。
There might be other issues but the first thing I noticed in FireBug is you have a script error:
jQuery is not defined:
jQuery(this).css('marginLeft', -width/2);
This seems to be coming from selectToUISlider.JQuery.js
I would start by fixing this and see if you still hang. Might be unrelated but hard to tell while there are existing script errors.
您的网页“冻结”的原因是您正在进行大量的控件初始化,其中一些速度很慢。
在我的电脑上它最终会完成。
您可以放入隐藏的计时器来准确找出最慢的部分在哪里。
另外,查看 chrome 调试器我可以看到这个请求 http://www.funcampuses.com/wizard/false 需要很长时间。
The reason your web page is "freezing" is because you are doing lots and lots of control initialization and some of it is slow.
On my computer it will eventually finish.
You could put in hidden timers to find out exactly where in the slowest parts are.
Also, looking chrome debugger I can see this request http://www.funcampuses.com/wizard/false it taking a very long time.
我的问题是我正在调用一个自定义函数来计算不可见项目的宽度。我对每个滑块 (~40) 中的每个标签(平均~10)都这样做。
显然,这已经是非常糟糕的事情了!
My problem was that I was calling a custom function for calculating the width of an invisible item. I was doing that for every label (average of ~10) in each slider (~40).
Obviously, this was very bad!