javascript jQuery 表格行展开/折叠

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6119356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 19:34:09  来源:igfitidea点击:

jQuery table row expand/collapse

javascriptjquerycsscollapsable

提问by calebo

I've got a table and it has rows that are collapsible when clicked on the table heading.

我有一个表格,当点击表格标题时,它的行是可折叠的。

Problem is it doesn't seem to be very smooth, there's a lag and jump once I click on the header and when the content shows. Does anyone know how to fix this?

问题是它似乎不是很流畅,一旦我点击标题和内容显示,就会出现滞后和跳跃。有谁知道如何解决这一问题?

See example build »

查看示例构建 »

回答by VinayC

Unfortunately, table rows does not animate (with jquery) - see this related question on SO: How to Use slideDown (or show) function on a table row?

不幸的是,表格行没有动画(使用 jquery) - 请参阅关于 SO 的相关问题:How to Use slideDown (or show) function on a table row?

Work-around will be to use div based layout or try out wrapping td content into divs and animating those divs - see this fiddle. Of course, you have to adjust the css.

解决方法是使用基于 div 的布局或尝试将 td 内容包装到 div 中并为这些 div 设置动画 - 参见这个 fiddle。当然,你必须调整css。