Javascript / jQuery不会在IE中执行,直到页面正文被覆盖 [英] Javascript / jQuery not executing in IE until the body of the page is moused over

查看:84
本文介绍了Javascript / jQuery不会在IE中执行,直到页面正文被覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 http://www.nitrohandsome.com 的新投资组合网站上工作,我正在利用这些经验来磨练jQuery。我正在使用最新版本和jcarouselite以及主页上的缓动扩展,以获得漂亮的旋转木马效果。它在大多数浏览器中运行良好,但是当我开始在IE中进行测试时(7和8,还没有开始针对6.5进行优化)我发现jQuery在加载文档后不会立即执行代码。相反,似乎要等到鼠标移动到html本身。这导致我的轮播显示像列表和我的主菜单按钮,直到用户移动鼠标才能正确呈现。我使用 browsershots.org 检查它是否只发生在我的机器上,但遗憾的是没有。任何人都可以为我阐明这一点吗?我是jQuery的新手,虽然我对其他ECMA语言如Actionscript非常熟悉,但我对javascript只有一点经验,但我很熟悉。

I'm working on a new portfolio site at http://www.nitrohandsome.com, and am using the experience to cut my teeth on jQuery. I'm using the latest build and jcarouselite along with the easing extension on my main page for a nifty carousel effect. It works fine in most browsers, but when I started testing in IE (7 and 8, haven't started optimizing for 6.5) I find that jQuery does not execute code as soon as the document is loaded. Rather, it seems to wait until one moves the mouse on to the body of html itself. This causes my carousel to display like a list and my main menu buttons to not render properly until the user moves the mouse. I used browsershots.org to check if it was only happening on my machine, but sadly not. Can anyone shed some light on this for me? I'm a novice with jQuery, and have only a bit more experience with javascript in general, although I am quite familiar with other ECMA languages such as Actionscript.

我会发布源代码,但帖子的实时预览显示它会尝试呈现HTML。

I would post the source, but the live preview of the post shows that it would try to render the HTML.

提前致谢。

推荐答案

你的代码中有一个额外的逗号。检查它是这样的:

You have an extra comma somewhere in your code. Check it for something like this:

{
 param: "whatever",
 param2: "whatever", // <- extra comma!
}

IE就死了,而Firefox没有。

IE dies on these while Firefox does not.

编辑:这是额外的逗号:

$("#carousel").jCarouselLite({
    btnNext: "#next",
    btnPrev: "#prev",
    visible: 3,
    easing: "easeout",
    speed: 150, // <- REMOVE THIS COMMA
});

第二次编辑:

为了以后找到这个页面的人,他的页面显示不正确的原因是因为jQuery的1.3.1 记录 问题与document.ready在图像之后触发或根本不触发。修复了最新的jQuery版本就行了。

For the sake of anyone that finds this page later on, the reason his page was not showing correctly was because of jQuery's 1.3.1 documented problems with document.ready firing after images or not at all. A fix to the latest jQuery version did the trick.

这篇关于Javascript / jQuery不会在IE中执行,直到页面正文被覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆