iconic / SVGInjector

Fast, caching, dynamic inline SVG DOM injection library
MIT License
974 stars 145 forks source link

How to dynamically change direction of icon? #28

Open dfischer opened 9 years ago

dfischer commented 9 years ago

How do you dynamically change the direction of iconic with the svginjector? Since the svginjector removes the <img> element what are you supposed to do to update the direction of the svg? Do you have to completely remove that node from dom and try to re-render it or?

protodave commented 9 years ago

Hey Daniel! SVGInjector itself doesn't do anything specific related to the display of SVG assets... it just gets them on the page by swapping out the related <img> tag. Once the SVG is on the page you are free to adjust its display using CSS3 2D & 3D transforms.

Or is this an Iconic specific question related to the dynamic "Smart Icons", some of which have a data-direction attribute? If so, take a look at the Smart Icon Guide to see how to update an icon via their built-in APIs and also via their attributes after the initial injection has take place at page load time.

Also, feel free to share a code snippet of what you are trying to do and I can help debug or explain further.