jQuery SVG to inline
A jQuery plugin to replace and embedding SVG inline.
Table of Contents
Examples
<object class="svg myClass" type="image/svg+xml" data="htts://somesvg.svg"></object>
or
<img src="https://somesvg.svg" class="svg myClass otherClass">
Will generate
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" class="myClass otherClass">
<circle cx="50" cy="50" r="50"/>
</svg>
Usage
$( ".svg" ).svgToInline();
Options
useTriggerClass
By default the trigger class will isn't used on inline svg. If you want use set to true
.
$( ".svg" ).svgToInline({useTriggerClass: true});
Example
<img src="https://somesvg.svg" class="svg myClass otherClass">
Will generate
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" class="svg myClass otherClass">
<circle cx="50" cy="50" r="50"/>
</svg>
License
Jquery SVG to inline is released under the terms of the MIT license.