IE8和jQuery空指针 [英] IE8 and jQuery null pointers
问题描述
全文:
消息:'undefined'为空或不是对象
行:22
字符:16
代码:0
URI:http://www.philipdukes.co.uk/jquery.bgpos.js
消息:'undefined'为null或不是对象
Line :22
Char:16
代码:0
URI:http://www.philipdukes.co.uk/jquery.bgpos.js
在我的网页标题中,我加载了jquery 1.3.2,然后在错误链接中找到了这个bgpos库,然后我的主页脚本。
我随时翻转导航按钮,IE8抛出此错误...
任何帮助将不胜感激:我知道我的代码可能不是最时尚的,所以建设性的强烈的>批评也是受欢迎的。我想专注于这个错误...
shearn89
踩过东西,几乎好像它正在爆炸,因为
$(item).css({backgroundPosition: '0 -246px'});
在您的主页脚本的else子句中不存在。
编辑:刚刚注意到Jitter在上面添加了当没有设置显式值时,IE8可能会返回未定义的背景位置。尝试在else中设置backgroundPosition,看看会发生什么。
hey guys: I've been building a website with some animated rollovers, where I animate the background image to give a colour fade effect. It works fine in FF3, Safari, chrome, but IE8 throws the "undefined is null or not an object" error.
Full text:
Message: 'undefined' is null or not an object
Line: 22
Char: 16
Code: 0
URI: http://www.philipdukes.co.uk/jquery.bgpos.js
Message: 'undefined' is null or not an object
Line: 22
Char: 16
Code: 0
URI: http://www.philipdukes.co.uk/jquery.bgpos.js
In my web page header I load jquery 1.3.2, then this bgpos library, found at the link in the error, then my homepage script.
Anytime I rollover the nav buttons, IE8 throws this error...
Any help would be appreciated: I know my code may not be the most stylish out there, so constructive criticism on that would also be welcome. I'd like to focus on this error though...
shearn89
Stepping through things, it almost seems like it's blowing up because
$(item).css({backgroundPosition: '0 -246px'});
doesn't exist in the else clause of your homepage script.
Edit: Just noticed that Jitter added above that "Maybe IE8 returns undefined for background-position when no explicit value is set." Try setting the backgroundPosition in the else and see what happens.
这篇关于IE8和jQuery空指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!