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.
我想找到一种在单击某个元素时停止 SVG 中所有矩形元素上的所有动画的方法。我正在尝试使用这样的东西:
svg.select("rect").stop();
但我不能让它工作
选择某种类型的所有元素,然后运行 a forEach,传入一个接受每个单独元素的函数。
forEach
svg.selectAll("rect").forEach(function(elem){elem.stop();});