Skip to content

piersrueb/insertSvg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Insert Svg

Dynamically insert SVGs directly into the dom.

Place the path to the svg within the data attribute.

<div class="my-class" data-svg="img/cta.svg"></div>

Insert

Call the function on your class.

insertSvg('.my-class');

Replace

By default the svg is inserted within the node. To instead replace the node with the svg add the replace class to the element. All element classes are preserved.

<div class="my-class replace" data-svg="img/cta.svg"></div>

About

Dynamically insert SVGs directly into the dom.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published