Background: I'm using snap.svg to animate paths in an inline svg, and I'm trying to animate several paths in one function.
Problem: using the code below, I'm only able to select a single path in one grab function. In the code below, I've used multiple selectors, but the animation only affects rect#rect-one. How can I select multiple paths in Snap.svg?
Thanks for the help!
HTML/Inline SVG:
<a id="one">link</a>
<svg>
<rect id="rect-one" fill="#231F20" width="39" height="14"/>
<rect id="rect-two" x="54" fill="#231F20" width="39" height="14"/>
<rect id="rect-three" x="104" fill="#231F20" width="39" height="14"/>
</svg>
Snap:
window.onload = function () {
var grabLink = Snap.select('body a#one'),
grabPathRectangles = Snap.select('#rect-one, #rect-two, #rect-three');
function colorPathRectangles(){
grabPathRectangles.animate({fill: 'red'}, 100, mina.ease);
}
function resumePathRectangles(){
grabPathRectangles.animate({fill: 'green'}, 100, mina.ease);
}
grabLink.hover(colorPathRectangles, resumePathRectangles);
};