https://github.com/mberneti/jquery-svg
A jQuery plugin to apply css styles and js scripts to a SVG which is embedded (using the <object> tag).
https://github.com/mberneti/jquery-svg
jquery jquery-plugin jquery-svg js svg
Last synced: 8 months ago
JSON representation
A jQuery plugin to apply css styles and js scripts to a SVG which is embedded (using the <object> tag).
- Host: GitHub
- URL: https://github.com/mberneti/jquery-svg
- Owner: mberneti
- License: mit
- Created: 2016-03-18T14:44:29.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-16T12:10:18.000Z (over 8 years ago)
- Last Synced: 2024-08-01T18:29:25.256Z (over 1 year ago)
- Topics: jquery, jquery-plugin, jquery-svg, js, svg
- Language: HTML
- Size: 50.8 KB
- Stars: 27
- Watchers: 5
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```html
```
2. Include plugin's code:
```html
```
3. Call the plugin:
```javascript
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
- [test with embed css](http://mberneti.github.io/jquery-svg/)
- [test with linked css](http://mberneti.github.io/jquery-svg/test-linked-css.html)