Reputation: 1129
I want to find a way of stopping all animations on all rectangle elements within the SVG when a certain element is clicked. I'm trying to use something like this:
svg.select("rect").stop();
but I can't get that to work
Upvotes: 3
Views: 3459
Reputation: 5349
Select all elements of a certain type and then run a forEach
, passing in a function that takes each individual element.
svg.selectAll("rect").forEach(function(elem){elem.stop();});
Upvotes: 6