Apply CSS Animations To SVG Images - Inline SVG

Apply CSS Animations To SVG Images - Inline SVG
File Size: 5.58 KB
Views Total: 1451
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

Inline SVG is a jQuery plugin which makes you img embedded SVG content (polygon, stroke, circle) be styled and animated with CSS / CSS3.

See also:

How to use it:

1. Embed a SVG image into your webpage using img tag without lengthy SVG code.

<img src="image.svg" class="inline-svg svg">

2. Load jQuery library and the jQuery inline svg plugin's script right before the </body> tag.

<script src="//"></script>
<script src="js/inline-svg.js"></script>

3. Initialize the plugin on the SVG image.


4. Animate the SVG image on mouse hover using CSS3 animations.

.svg {
  max-width: 200px;
  cursor: pointer;

.svg polygon { transition: stoke .5s ease-out, fill 2s ease-out; }

.svg:hover polygon {
  stroke: #00bdd6 !important;
  fill: #00bdd6 !important;

.svg circle { stroke-dasharray: 154; }

.svg:hover circle {
  stroke: #00bdd6 !important;
  animation: dash 3s linear infinite;

dash {  to {
 stroke-dashoffset: 308;

Change log:


  • Keeping track of ajax requests that have been made and preventing duplicates from going out


  • Fixing mutiple bad requests for images.


  • Updating so that it utilizes this.selector so the MutationObserver watches for elements with the original plugin selector.


  • Detecting Loaded


  • Checking on Response type

This awesome jQuery plugin is developed by zaneray. For more Advanced Usages, please check the demo page or visit the official website.