js-draggable

1.0.5 • Public • Published

Simple JS Draggable

Example

window.addEventListener('DOMContentLoaded', function() {
  var el = document.querySelector('#elem');

  var draggable = new Draggable(el);

  draggable
    .on('dragstart', function() { console.log('dragstart', this); })
    .on('dragend', function() { console.log('dragend', this); })
    .on('move', function() { console.log('move', this.diffX, this.diffY); });
});

Credits

Based on TZDragg by thezillion

Readme

Keywords

Package Sidebar

Install

npm i js-draggable

Weekly Downloads

6

Version

1.0.5

License

MIT

Unpacked Size

108 kB

Total Files

7

Last publish

Collaborators

  • tannerhodges