[英]jQuery cross-browser issue
I have this code that works great in all browsers but not IE6, and I have no idea why, can anyone shed any light on this? 我有这个代码,适用于所有浏览器但不是IE6,我不知道为什么,任何人都可以对此有所了解吗?
$("#handle").toggle(
function () {
$('#login').animate({
marginTop: '0',
}, 1000);
$("#handle").addClass('opened');
return false;
},
function () {
$('#login').animate({
marginTop: '-280',
}, 1000);
$("#handle").removeClass('opened');
return false;
}
);
You have trailing commas in the object literals passed to animate()
. 传递给
animate()
的对象文字中有尾随逗号。 IE does not support this. IE不支持这一点。 This should work:
这应该工作:
$('#login').animate({
marginTop: '0' //No comma, can you see it?
}, 1000);
Yes, I guess I can. 是的,我想我可以。
The EVIL COMMA has GOT you !! EVIL COMMA有GOT你!!
marginTop: '0', // remove comma
and 和
marginTop: '-280', // remove comma
Trailing commas are a big NoNo in IE's. 尾随逗号是IE中的一个重要的NoNo。
也不应该
"-280px" // added "px"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.