Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个在网页上执行动画的脚本。在这个过程中,我需要将几个元素添加到一个数组中,然后同时为它们设置动画。
是否可以使用 jQuery 同时为数组中的所有对象设置动画?或者也许有更好的方法?
谢谢
$.each(ARRAY, function(index, value) { // do amazing things such as: $(this).hide(200); });
如果您在一个数组中有多个 DOM 元素,您需要做的就是将它们放入一个 jQuery 对象中,然后制作动画。
$( arrayOfElements ).fadeOut();