jquery-svg
A lightweight jQuery plugin to apply css styles and js scripts to a SVG which is embedded (using the <object> tag).
Usage
-
Include jQuery:
<script src="../lib/jquery.min.js"></script>
-
Include plugin's code:
<script src="../dist/jquery.svg.es5.min.js"></script>
-
Call the plugin:
window.onload = function(){ //apply embed css to the svg object $("#cars").setSVGStyle(style); //or //apply css by stylesheet link $("#cars").setSVGStyleLink(stylepath); //get svg object, like a jquery object var svg = $("#cars").getSVG(); //use jquery functions to do some thing svg.find("g path:first-child()").attr('fill', color); };