Skip to content

mberneti/jquery-svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published