简体   繁体   English

mootools FX.slideOut折叠表格行

[英]mootools FX.slideOut collapses table row

I'm borrowing some code from a David Walsh tutorial on animated delete with mootools. 我是从David Walsh的教程中借用了一些代码,该教程介绍了如何使用mootools进行动画删除。

When I use the Mootools FX.slide on a table row, it sort of collapses the row horizontally before sliding it up, which is not the desired effect. 当我在表行上使用Mootools FX.slide时,它在向上滑动之前会水平折叠该行,这并不是理想的效果。

There's a fiddle here if you'd like to take a look-- http://jsfiddle.net/gNvvT/ 如果您想看看这里有个小提琴-http: //jsfiddle.net/gNvvT/

How can I make this effect a smooth slide vertically, rather than collapsing left, then up? 如何使这种效果在垂直方向上平滑滑动,而不是向左折叠然后向上折叠?

Thanks! 谢谢!

this is because TR are not real block style elements, it's display: table-row (iirc). 这是因为TR不是真正的块样式元素,因此display: table-row (iirc)。

The Fx.Slide class actually has just 2 tricks it tries to employ to make it appear like it's dissolving, basically: 实际上, Fx.Slide类只有两个技巧,试图使之看起来像是在溶解,基本上是这样:

  1. set overflow from visible to hidden, which - in the context of a TR, makes no sense. 将溢出从可见设置为隐藏,这在TR的背景下是没有意义的。
  2. (optional) it can wrap an element in a wrapper and then collapse that, but once again, the wrapper becomes the direct parent of the element and it's a div, which you cannot do in a table. (可选)它可以将元素包装在包装器中,然后将其折叠,但是包装器再次成为该元素的直接父级,并且它是一个div,您不能在表中执行此操作。

it then allows it to manipulate the height of the element and make it smaller etc. 然后,它允许它操纵元素的高度并使之变小等。

the jump happens as it changes the display/overflow and it all goes funny after as it collapses the table. 跳转的发生是因为它更改了显示/溢出,并且在折叠表格之后,一切都变得很有趣。

you should consider an alternative way, like fade and when available, scale transform. 您应该考虑使用另一种方法,例如淡入淡出和缩放(如果可用)。

I'm afraid Fx.Slide can't work with table rows, but only with block elements. 恐怕Fx.Slide不能用于表行,而只能用于块元素。
As Dimitar Christoff said to you. 正如Dimitar Christoff对您所说的。

I've modified your fiddle to get around this problem. 我已经修改了您的小提琴以解决此问题。 From the code you posted, it seems you are quite practical with Mootools, so I just wrote some comments on the code. 从您发布的代码来看,您似乎对Mootools相当实用,因此我只是在代码上写了一些注释。 I'm sure you will get the trick. 我相信您会成功的。

http://jsfiddle.net/gNvvT/5/ http://jsfiddle.net/gNvvT/5/

Let me know if it works on your real world application! 让我知道它是否适用于您的实际应用!

Edit. 编辑。 There was some useless code I left from previous tests. 我以前的测试中留下了一些无用的代码。 I removed it and I updated the fiddle URL. 我删除了它,并更新了小提琴URL。

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

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