该页面在 IE 中挂起很长时间,但 Chrome/FF 可以正常运行。
这是有问题的页面 http://174.120.239.48/~peakperf/
=============
网页错误详情
用户代理:Mozilla/4.0(兼容;MSIE 8.0;Windows NT 6.1;WOW64;Trident/4.0;SLCC2;.NET CLR 2.0.50727;Media Center PC 6.0;.NET4.0C;.NET4.0E;. NET CLR 3.5.30729;.NET CLR 3.0.30729) 时间戳:2011 年 3 月 7 日星期一 21:18:49 UTC
消息:未实现
行:432 字符:7 代码:0 网址:http://174.120.239.48/~peakperf/wp-content/themes/strausberg/js/jquery.simplemodal-1.4.1.js
==========
这是 js 的 pastebin: http://pastebin.com/xXaCK6XH
这是有问题的js: http://174.120.239.48/~peakperf/wp-content/themes/strausberg/js/jquery.simplemodal-1.4.1.js
谢谢!
最佳答案
您需要确保任何操作 DOM 的 Javascript (jQuery) 发生在 ready() 中文档
的事件。
在您的 HTML 中的几个地方,当脚本标记被解析时,您正在修改 DOM。现在,如果您查看 IE 开发工具栏,您会注意到以下内容:
SCRIPT16385: Not implemented
jquery.simplemodal-1.4.1.js, line 432 character 7
LOG: [cycle] DOM not ready, queuing slideshow
LOG: [cycle] DOM not ready, queuing slideshow
LOG: [cycle] DOM not ready, queuing slideshow
LOG: [cycle] terminating; too few slides: 0
LOG: [cycle] terminating; zero elements found by selector
我认为有问题的 Javascript 是:
<Script type="text/javascript">
jQuery(".basic").modal({overlayClose:true});
</script>
应该改为:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".basic").modal({overlayClose:true});
});
</script>
关于jquery - IE 卡在 js 错误上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5225410/