mootools FX.slideOut 折叠表格行
我借用了 David Walsh 教程中关于使用 mootools 进行动画删除的一些代码。
当我在表格行上使用 Mootools FX.slide 时,它会在向上滑动之前水平折叠该行,这不是所需的效果。
如果您想看一下,这里有一个小提琴 - http://jsfiddle.net/gNvvT/
我怎样才能使这种效果垂直平滑滑动,而不是向左折叠,然后向上折叠?
谢谢!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
恐怕
Fx.Slide
无法处理表格行,而只能处理块元素。正如 Dimitar Christoff 对您所说的那样。
我已经修改了你的小提琴来解决这个问题。从你发布的代码来看,你对Mootools似乎很实用,所以我只是在代码上写了一些注释。我相信你会明白其中的窍门的。
让我知道如果它适用于您的现实世界应用程序!
编辑。我在之前的测试中留下了一些无用的代码。我删除了它并更新了小提琴 URL。
I'm afraid
Fx.Slide
can't work with table rows, but only with block elements.As Dimitar Christoff said to you.
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. I'm sure you will get the trick.
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.
这是因为
TR
不是真正的块样式元素,它是display: table-row
(iirc)。Fx.Slide 类实际上只有 2 个技巧,它尝试使用它来使其看起来像是正在溶解,基本上:
然后它允许它操纵元素的高度并使其变小等等。
跳跃发生在它改变显示/溢出时,并且当它折叠表格时一切都变得有趣。
您应该考虑另一种方法,例如淡入淡出和缩放变换(如果可用)。
this is because
TR
are not real block style elements, it'sdisplay: 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: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.