How To Use Snap.svg Code Multiple Times?
this demo . I want to make Icons using Snap.svg, so i want end user to repeating HTML to getting multiple icons. HTML:
Solution 1:
You need to iterate through each .box
and instantiate Snap on each element, this is an example:
var boxes = [].slice.call(document.querySelectorAll(".box"));
boxes.forEach(function(box){
var box = Snap(box);
box.rect(0,0,100,100).attr({fill:"#f00"});
});
Working example here:
Post a Comment for "How To Use Snap.svg Code Multiple Times?"