jQuery 同时对数组中的所有对象进行动画处理

发布于 2024-09-27 10:11:48 字数 125 浏览 2 评论 0原文

我正在编写一个在网页上制作动画的脚本。 在此过程中,我需要将多个元素添加到数组中,然后同时对它们进行动画处理。

是否可以使用 jQuery 同时对数组中的所有对象进行动画处理?或者也许有更好的方法?

谢谢

I am writing a script that does animations on a web-page.
In the process I need to add several elements to an array, and then simultaneously animate them.

Is it possible to use jQuery to SIMULTANEOUSLY animate all objects in an array? Or maybe there's a better method for that?

Thanx

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

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

发布评论

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

评论(2

温暖的光 2024-10-04 10:11:48
$.each(ARRAY, function(index, value) { 
  // do amazing things such as:
  $(this).hide(200);
});
$.each(ARRAY, function(index, value) { 
  // do amazing things such as:
  $(this).hide(200);
});
海的爱人是光 2024-10-04 10:11:48

如果数组中有多个 DOM 元素,您所需要做的就是将它们放入 jQuery 对象中,然后执行动画。

$( arrayOfElements ).fadeOut();

If you have several DOM elements in an array, all you need to do is slip them into a jQuery object, and do your animation.

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