Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IE9之前版本中的JQuery动画_Jquery_Internet Explorer_Internet Explorer 8 - Fatal编程技术网

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'效果很好