jquery - reusing snap.svg loaded svg into different elements -
I am trying to load an SVG using snap. Svg and add many SVG elements on one page. I can only work on loading this one instance, but when I add it to several elements it fails.
s1 = snap ('# step1'); S2 = Snap ('# step2'); S3 = Snap ('# Step3'); Snap.load ('img / steps.svg', function (l) {s1.append (l); s2.append (l); s3.append (l);});
There is a JSfield
snap.load ('https://rawgit.com/VengadoraVG/moving-to-gnulinux/master/img/tux.svg', function (l) {var g = l.select ("g") ; S1.append (g.clone ()); s2.append (g.clone ()); s3.append (g.clone ());});
In your bedel you are loading an SVG (Tecus SVG) in SVG Elements (# Step1, # Step2, # Step3). Simply select the first g
and clone it every time you want to add it.
Comments
Post a Comment