为什么我的网站上的 IE 中的 Javascript 会损坏?
这是网站:http://designsweeter.com/ 它适用于除 IE 之外的所有浏览器(任何版本,包括 9)。 我正在使用 jQuery、Modernizr 和幻灯片Js。 但我的 javascript 都不起作用。有什么线索吗? 这是 js 文件: http://designsweeter.com/scripts.js
未缩小(顺序相同)我的js文件):
modernizr:http://www.modernizr.com/downloads/modernizr-2.0.6.js jquery 1.6: http://code.jquery.com/jquery-1.6.1.js< /a> jquery 缓动: http://gsgd.co.uk/sandbox/ jquery/easing/jquery.easing.1.3.js Slidesjs: http://designsweeter.com/non-packed-js/slides.js jQuery 平滑滚动:
$(document).ready(function() {
$("a.topLink").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
}, {
duration: 500,
easing: "swing"
});
return false;
});
});
谢谢!
Here's the site: http://designsweeter.com/
It work sin all browsers but IE (any version, including 9).
I'm using jQuery, Modernizr, and slidesJs.
But none of my javascript is working. Any clue why?
Here's the js file: http://designsweeter.com/scripts.js
Unminified (same order they are in my js file):
modernizr: http://www.modernizr.com/downloads/modernizr-2.0.6.js
jquery 1.6: http://code.jquery.com/jquery-1.6.1.js
jquery easing: http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js
slidesjs: http://designsweeter.com/non-packed-js/slides.js
jQuery Smooth Scroll:
$(document).ready(function() {
$("a.topLink").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
}, {
duration: 500,
easing: "swing"
});
return false;
});
});
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这行:
滚动顶部: $($(this).attr("href")).offset().top + "px"
;婴儿!
;行尾缺失。我敢打赌你的未压缩代码也可以在 IE 上运行。
This line:
scrollTop: $($(this).attr("href")).offset().top + "px"
; Baby!
; is missing at the end of the line. I bet your unminified code will work on IE too.
当我在 Chrome 中访问您的网站时,我收到了一堆 console.log 信息。尝试删除所有 console.log() 代码(IE 不支持它,因此它会破坏您的所有 JavaScript)。
或者,您可以将此代码添加到页面顶部以处理任何不支持 console.log() 的浏览器。
When I visit your site in Chrome I get a bunch of console.log information. try removing all console.log() code (it's not supported in IE so it'll break all your javascript).
Alternatively you could add this code to the top of your page to handle any browser that doesn't support console.log().