A pure JavaScript plugin that be able to insert SVG elements which are modifiable instead of IMG or OBJECT elements from SVG files.
Add svgtag.js file as script
tag.
<script src="svgtag.js"></script>
Or minify file with svgtag.min.js.
<script src="svgtag.min.js"></script>
There are two ways to perform SVGTag.
Add img
or object
tags with svg-tag
attribute.
<img svg-tag src="demo_a.svg" />
<object svg-tag data="demo_a.svg"></object>
Use SVGTag.scan
method to find all SVGTag-elements and launch them.
SVGTag.scan();
Add img
or object
tag normally.
<img id="DemoB" src="demo_b.svg" />
<object id="DemoB" src="demo_b.svg"></object>
Perform each SVGTag-element by pointing the original element.
SVGTag.new(document.getElementById("DemoB"));
Create a SVGTag-element from a img
or object
element.
_element = SVGTag.new( _originalElement )
parameter: _originalElement:HTMLElement / return: _element:HTMLElement
Launch all SVGTag-elements in document body.
SVGTag.scan()
An array of SVGTag-elements.
_ary = SVGTag.list
return: _ary:Array (include HTMLElements)
Released under the MIT license.