Skip to content
Simple script that inject SVG content to HTML.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
svginjector.js

README.md

svginjectoor

Simple script that inject SVG content to HTML.

The purpose of the script is to handle SVG stuff that you want to put inline. For instance set of icons that you want to style and add interactive stuff. This possible only with inline SVG, but this way it's exorbitantly bloat your html code. Script do the one thing: insert SVG inline when DOM is loaded.

How to use

  1. Add class name to the selector
  2. Paste SVG code to the function SVG will be inserted to all containers with corresponding class name.

It's can be useful for complex icon sets that can be stored in one JS file. This also reduces server requests because only one JS file loeaded once.

You can’t perform that action at this time.