当对象在 jQuery 中隐藏时,周围的元素会捕捉到新位置。我怎样才能让它们动画到新的位置?

发布于 2024-09-12 04:18:40 字数 192 浏览 4 评论 0原文

我有一份清单,其中有 20 项。每个都是 3 列的框,类似于网格格式。

网格上方是允许您显示和隐藏列表中不同项目的选项,具体取决于您要查找的内容。

当用户隐藏特定列表项时,它们会淡出,所有其他项目都会捕捉到新位置。

平滑的淡入淡出效果之后,捕捉动作看起来不太好。它们是使元素滑入新位置的一种方法吗?

谢谢。

I have a list of say, 20 items. Each of them are boxes in 3 columns, like a grid format.

Above the grid are options which allow you to show and hide different items within the list, depending on what you are looking for.

When a user hides specific list items, they fade out and all of the other items snap into their new positions.

After the smooth fade effect, the snapping action doesn't look too nice. Is their a way to make the elements slide into their new positions?

Thank you.

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

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

发布评论

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

评论(2

婴鹅 2024-09-19 04:18:40

你应该看看 jQuerys 动画函数 这个例子应该几乎可以做你想要的

 $('#clickme').click(function() {
  $('#book').animate({
    opacity: 0,
    height: 'toggle'
  }, 5000);
});

you should look into jQuerys animate function the example should pretty much do what you want

 $('#clickme').click(function() {
  $('#book').animate({
    opacity: 0,
    height: 'toggle'
  }, 5000);
});
疯到世界奔溃 2024-09-19 04:18:40

对隐藏元素的不透明度和高度进行动画处理。

Animate the opacity and height of the element you're hiding.

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