Apply CSS Animations To SVG Images - Inline SVG
| File Size: | 5.58 KB |
|---|---|
| Views Total: | 1603 |
| 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="//code.jquery.com/jquery-3.1.1.min.js"></script> <script src="js/inline-svg.js"></script>
3. Initialize the plugin on the SVG image.
$('.inline-svg').inlineSVG();
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;
}
@keyframes
dash { to {
stroke-dashoffset: 308;
}
}
Change log:
2017-05-18
- Keeping track of ajax requests that have been made and preventing duplicates from going out
2017-03-04
- Fixing mutiple bad requests for images.
2017-02-28
- Updating so that it utilizes this.selector so the MutationObserver watches for elements with the original plugin selector.
2017-02-16
- Detecting Loaded
2017-02-10
- 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.











