简体   繁体   English

为表格行设置动画以使其滑出或淡入?

[英]animate the table rows to slide out or fade in?

I stumbled upon this plugin 我偶然发现了这个插件

https://jquery-datatables-row-grouping.googlecode.com/svn/trunk/customization.html https://jquery-datatables-row-grouping.googlecode.com/svn/trunk/customization.html

the problem is, everything is in <tr> s and I fear you cannot animate them? 问题是,一切都在<tr> ,我担心您不能为它们设置动画?

Is there really no way? 真的没有办法吗? CSS or javascript wise. CSS或JavaScript明智的。

eg I want to animate a tables tr elements. 例如,我想为表格tr元素设置动画。

Maybe one solution could be like that : 也许一种解决方案可能是这样的:

 var animate = function(evt) { //we go to the 'tr' tag $el = $(evt.currentTarget).parent().parent(); //we hide the 'td's tag $el.find('td').hide(333 , function(){ // we reduce the height of 'tr' tag $el.animate({height : 0} , 777) }); } $('button').click(animate); 
 table { border: solid 1px #AAA; padding: 3px; border-collapse: separate; } td { height: 50px; margin : 3px; min-width : 50px; border: solid 1px orange; } tr { height : 55px; padding : 12px; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <tr> <td>a</td><td>b</td><td><button>hide</button></td> </tr> <tr> <td>a</td><td>b</td><td><button>hide</button></td> </tr> <tr> <td>a</td><td>b</td><td><button>hide</button></td> </tr> </table> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM