A lightweight library for manipulating and animating SVG.
-Svg.js has no dependencies and aims to be under 5k gzipped. The base library is 2.7k gzipped, with all bells and whistles about 4.6k.
+Svg.js has no dependencies and aims to be under 5k gzipped. The base library is 2.7k gzipped, with all bells and whistles about 4.7k.
Svg.js is licensed under the terms of the MIT License.
## Events
-All usual events are accessible on elements:
+Events can be bound to elements as follows:
```javascript
rect.click(function() {
});
```
+You can also bind event listeners to elements:
+
+```javascript
+var click = function() {
+ rect.fill({ color: '#f06' });
+};
+
+rect.on('click', click);
+```
+
+Note that the context of event listeners is not the same as events, which are applied directly to the element. Therefore `this` will not refer to the element when using event listeners.
+
+Unbinding events is just as easy:
+
+```javascript
+rect.off('click', click);
+```
+
+But there is more to event listeners. You can bind events to html elements as well:
+
+```javascript
+SVG.on(window, 'click', click);
+```
+
+Obviously unbinding is practically the same:
+
+```javascript
+SVG.off(window, 'click', click);
+```
+
Available events are `click`, `dblclick`, `mousedown`, `mouseup`, `mouseover`, `mouseout`, `mousemove`, `touchstart`, `touchend`, `touchmove` and `touchcancel`.
- [svg.shapes.js](https://github.com/wout/svg.shapes.js) for more polygon based shapes.
- [svg.easing.js](https://github.com/wout/svg.easing.js) for more easing methods on animations.
+- [svg.draggable.js](https://github.com/wout/svg.draggable.js) for more easing methods on animations.
## To-do
-- Draggable module (make elements and groups draggable)
+- Instance module
- Text on path module (write text along paths)