🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

SVG.js is a lightweight and simple to use jQuery plugin which lets you apply custom CSS/CSS3 style to your SVG object.

SVG

Documentation

jquery-svg

A lightweight jQuery plugin to apply css styles and js scripts to a SVG which is embedded (using the <object> tag).

Usage

  1. Include jQuery:

    <script src="../lib/jquery.min.js"></script>
  2. Include plugin's code:

    <script src="../dist/jquery.svg.es5.min.js"></script>
  3. 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);                      };

Demo


You May Also Like