在IE中使用jQuery.animate()时出错
我有以下jQuery版本1.4.4的代码:在IE中使用jQuery.animate()时出错,jquery,internet-explorer,Jquery,Internet Explorer,我有以下jQuery版本1.4.4的代码: var currentMemberID = 1; $('div[memberContainer='+currentMemberID+']').fadeOut(500, function() { $(this).parent().animate({ height: '0px', margin: '0px',
var currentMemberID = 1;
$('div[memberContainer='+currentMemberID+']').fadeOut(500, function() {
$(this).parent().animate({
height: '0px',
margin: '0px',
padding: '0px'
}, 500, null);
});
这段代码在Google Chrome和Firefox中运行良好,但在IE 8中出现以下错误:
完成淡出操作后,参数“无效”
div的父级是一个
关于如何避免此错误,您有什么想法吗?淡出将元素的显示设置为0时的“无”。当显示设置为“无”时,IE通过“this”访问其父元素可能有问题 您是否尝试过设置不透明度动画
$("#childDiv").animate({ opacity: 0 }, 500, function() {
$(this).parent.animate({ height: '0px', width'0px' }, 500, null);
});
找到了一个解决方法:
$('div[memberContainer='+currentMemberID+']').fadeOut(500, function() {
$(this).parent().css('padding', '0px');
$(this).parent().animate({
height: '0px',
margin: '0px'
}, 500, null);
});
我现在正在更改动画外部的填充,效果很好