mootools FX.slideOut 折叠表格行

发布于 2024-12-22 13:12:13 字数 373 浏览 3 评论 0 原文

我借用了 David Walsh 教程中关于使用 mootools 进行动画删除的一些代码。

当我在表格行上使用 Mootools FX.slide 时,它​​会在向上滑动之前水平折叠该行,这不是所需的效果。

如果您想看一下,这里有一个小提琴 - http://jsfiddle.net/gNvvT/

我怎样才能使这种效果垂直平滑滑动,而不是向左折叠,然后向上折叠?

谢谢!

I'm borrowing some code from a David Walsh tutorial on animated delete with 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.

There's a fiddle here if you'd like to take a look-- http://jsfiddle.net/gNvvT/

How can I make this effect a smooth slide vertically, rather than collapsing left, then up?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烏雲後面有陽光 2024-12-29 13:12:13

恐怕 Fx.Slide 无法处理表格行,而只能处理块元素。
正如 Dimitar Christoff 对您所说的那样。

我已经修改了你的小提琴来解决这个问题。从你发布的代码来看,你对Mootools似乎很实用,所以我只是在代码上写了一些注释。我相信你会明白其中的窍门的。

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

让我知道如果它适用于您的现实世界应用程序!

编辑。我在之前的测试中留下了一些无用的代码。我删除了它并更新了小提琴 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.

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.

哥,最终变帅啦 2024-12-29 13:12:13

这是因为 TR 不是真正的块样式元素,它是 display: table-row (iirc)。

Fx.Slide 类实际上只有 2 个技巧,它尝试使用它来使其看起来像是正在溶解,基本上:

  1. 将溢出从可见设置为隐藏,这在 TR 的上下文中是没有意义的。
  2. (可选)它可以将元素包装在包装器中,然后折叠该元素,但包装器再次成为该元素的直接父级,并且它是一个 div,而您无法在表中执行此操作。

然后它允许它操纵元素的高度并使其变小等等。

跳跃发生在它改变显示/溢出时,并且当它折叠表格时一切都变得有趣。

您应该考虑另一种方法,例如淡入淡出和缩放变换(如果可用)。

this is because TR are not real block style elements, it's 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:

  1. set overflow from visible to hidden, which - in the context of a TR, makes no sense.
  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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文