In IE8, the line $liElement.animate({left:0},500);
breaks the page with an "Object doesn't support this property or method" error. $liElement
is the jQuery object I get from $('#开发者_运维百科mydiv li').eq(0);
$liElement.animate({},500);
does not cause an error.
I am using jQuery 1.5.1. How can I fix this?
To get to the source of this, you'll have to run this code under a debugger and find out (1) which object it's complaining about (2) which property or method it's complaining about. Then, you can work backward to see whose assumption is incorrect. Perhaps you could post a jsfiddle that has a minimal test case?
You need to make the element either absolutely or relatively positioned. Otherwise a value for left will be ignored.
wrap the call in a try catch:
try {
// animate
} catch (e) {
// handle error
}
精彩评论