为什么我的网站上的 IE 中的 Javascript 会损坏?

发布于 2024-11-17 07:58:47 字数 1253 浏览 6 评论 0原文

这是网站: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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青春如此纠结 2024-11-24 07:58:47

这行:
滚动顶部: $($(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.

嘿哥们儿 2024-11-24 07:58:47

当我在 Chrome 中访问您的网站时,我收到了一堆 console.log 信息。尝试删除所有 console.log() 代码(IE 不支持它,因此它会破坏您的所有 JavaScript)。

或者,您可以将此代码添加到页面顶部以处理任何不支持 console.log() 的浏览器。

if(typeof(console) === 'undefined') {
    console = {}
}

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().

if(typeof(console) === 'undefined') {
    console = {}
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文