0

I'm using leaflet js with custom markers. These markers need to move, change colors, and rotate. Movement is fairly simple as marker locations can be updated. For color I need to access a particular path on the image, which is an svg. Rotation should also be able to be handled if I can access the svg in js.

My thoughts on doing this were to load the svg in js, then modify this as needed before I assign it to a custom icon. Is there a simple way to load an svg in js so that it can be thusly manipulated without it being part of the DOM?

Any advice appreciated

David
  • 51
  • 1
  • 5

1 Answers1

0

If you want to manipulate an SVG with DOM methods but not include it in your main DOM, you'll want to use createDocumentFragment.

tmcw
  • 11,536
  • 3
  • 36
  • 45