我正在尝试向表格中添加一行并让该行滑入 View ,但是 slidedown 函数似乎正在向表格行添加 display:block 样式,这会打乱布局。
有什么解决办法吗?
代码如下:
$.get('/some_url',
{ 'val1': id },
function (data) {
var row = $('#detailed_edit_row');
row.hide();
row.html(data);
row.slideDown(1000);
}
);
最佳答案
表格行不支持动画。
来自 Chaffer 和 Swedberg 的“学习 jQuery”
Table rows present particular obstacles to animation, since browsers use different values (table-row and block) for their visible display property. The .hide() and .show() methods, without animation, are always safe to use with table rows. As of jQuery version 1.1.3, .fadeIn() and .fadeOut() can be used as well.
您可以将 td 内容包装在一个 div 中,然后在其上使用 slideDown。您需要确定动画是否值得额外标记。
关于jquery - 如何在表格行上使用 slideDown(或显示)功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/467336/