Javascript jquery slideDown()不起作用,但fadeIn()起作用
我正试着滑下去工作。我从php查询中将一些数据附加到div中。然后我想使用slideDown。相反,它只是出现了。我尝试fadeIn和fade动画。我的传入数据已将display:none作为其样式。为什么我的幻灯片只显示它,而fadeIn工作Javascript jquery slideDown()不起作用,但fadeIn()起作用,javascript,jquery,Javascript,Jquery,我正试着滑下去工作。我从php查询中将一些数据附加到div中。然后我想使用slideDown。相反,它只是出现了。我尝试fadeIn和fade动画。我的传入数据已将display:none作为其样式。为什么我的幻灯片只显示它,而fadeIn工作 if($(childTableId).length){ $(childTableId).remove(); }else{ $('#'+rowId).append(data); //Appen
if($(childTableId).length){
$(childTableId).remove();
}else{
$('#'+rowId).append(data); //Append the incoming PHP table to this div
$(childTableId).slideDown(1000);
}
此外,如果我使用slideUp(“slow”)来隐藏它(在remove()之前),我会发现它需要一段“缓慢”的时间才能消失。基本上,动画中的幻灯片部分没有发生 它不能slideDown()
,因为它不存在
if($(childTableId).length){
// If the element exists - remove it from the DOM
$(childTableId).remove();
} else {
// The element doesn't exist!
$('#'+rowId).append(data);
// By definition ... the element doesn't exist in the DOM,
// so it CANNOT be made to appear with slideDown()
$(childTableId).slideDown(1000);
}
它不能slideDown()
,因为它不存在
if($(childTableId).length){
// If the element exists - remove it from the DOM
$(childTableId).remove();
} else {
// The element doesn't exist!
$('#'+rowId).append(data);
// By definition ... the element doesn't exist in the DOM,
// so it CANNOT be made to appear with slideDown()
$(childTableId).slideDown(1000);
}
JQuery似乎无法执行类似于
slideDown()的动画代码>或slideUp()代码>在
元素上
试一试:
<table id="myTable" style="display:none">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Ian Spence</td>
</tr>
<tr>
<td>2</td>
<td>Bill Billy</td>
</tr>
</tbody>
</table>
<a href="#" onClick="$('#myTable').fadeIn();">Click Me</a>
身份证件
名称
1.
斯芬兹
2.
比尔·比利
该表将很好地淡入,但会更改fadeIn()代码>到一个slideDown()代码>和表格突然出现
关于对类似问题的回答:
由于浏览器对其可见显示属性使用不同的值(表行和块),表行对动画造成了特殊的障碍。没有动画的.hide()和.show()方法始终可以安全地用于表行。从jQuery版本1.1.3开始,也可以使用.fadeIn()和.fadeOut()
JQuery似乎无法执行类似于slideDown()的动画代码>或slideUp()代码>在
元素上
试一试:
<table id="myTable" style="display:none">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Ian Spence</td>
</tr>
<tr>
<td>2</td>
<td>Bill Billy</td>
</tr>
</tbody>
</table>
<a href="#" onClick="$('#myTable').fadeIn();">Click Me</a>
身份证件
名称
1.
斯芬兹
2.
比尔·比利
该表将很好地淡入,但会更改fadeIn()代码>到一个slideDown()代码>和表格突然出现
关于对类似问题的回答:
由于浏览器对其可见显示属性使用不同的值(表行和块),表行对动画造成了特殊的障碍。没有动画的.hide()和.show()方法始终可以安全地用于表行。从jQuery版本1.1.3开始,也可以使用.fadeIn()和.fadeOut()
为什么要在第2行执行remove()
而不是hide()
?如果表已经存在,我只想将其清除。无论哪种方式……当您取出1000
变量并仅使用.slideDown()时会发生什么代码>相同的问题。另外,通过使用hide(),我无法再让元素重新显示。它是display:none every now now.or您可以使用.show()
为什么要在第2行执行remove()
而不是hide()
?如果表已经存在,我只想将其清除。无论哪种方式……当您取出1000
变量并仅使用.slideDown()时会发生什么代码>相同的问题。另外,通过使用hide(),我无法再让元素重新显示。它是display:none ever now now.or你可以使用.show()
这不一定是真的-如果数据是hi
,而childTableId是#无论什么,那么他会附加它,它会再次存在。同样,fadein可以工作。从技术上讲,slideDown是可行的,只是没有动画。那我错了。尽管知道您的数据包含先前被证明不存在于if语句中的表会有所帮助。很高兴你找到了解决方案。这不一定是真的-如果数据
是hi
并且childTableId是#无论什么
,那么他会附加它,它会再次存在。fadein同样有效。从技术上讲,slideDown是可行的,只是没有动画。那我错了。尽管知道您的数据包含先前被证明不存在于if语句中的表会有所帮助。很高兴你找到了解决办法。