IE9之前版本中的JQuery动画
这可能是一个简单的解决方案,但我在任何地方都找不到任何东西 在我的代码中,我正在做:IE9之前版本中的JQuery动画,jquery,internet-explorer,internet-explorer-8,Jquery,Internet Explorer,Internet Explorer 8,这可能是一个简单的解决方案,但我在任何地方都找不到任何东西 在我的代码中,我正在做: $('#animateObject').animate({ 'position': 'absolute', 'height': thisWidgetSettings.detailHeight, width: thisWidgetSettings.detailWidth, marginTop: '-120px', marginLeft: '-320px', top:
$('#animateObject').animate({
'position': 'absolute',
'height': thisWidgetSettings.detailHeight,
width: thisWidgetSettings.detailWidth,
marginTop: '-120px',
marginLeft: '-320px',
top: $(window).height() / 2 - (parseInt(thisWidgetSettings.detailHeight, 10) / 2) + 120 + $(window).scrollTop(),
left: $(window).width() / 2 - (parseInt(thisWidgetSettings.detailWidth, 10) / 2) + 320 + $(window).scrollLeft()
}, 500);
在IE9、Safari、Firefox和Chrome中,这一切都非常有效,完全符合我的要求。但是,在IE7和IE8中,下面的行会导致错误
// JQuery 1.7.2 Line 8938
this.now = this.start + ( (this.end - this.start) * this.pos );
}
this.update();
我认为出现此错误的原因是,此时this.now已设置,如果传入的值不是数字,则this.now最终类似于“absoluteNaN”,导致更新函数失败。我是否向animate对象传递了错误的内容,或者这是JQuery的问题?原因是“animate”不适用于非数值,例如“-320px”。相反,输入'-320'效果很好