Skip to content

joyfulljs/draggable

Repository files navigation

make element draggable

Build Status codecov

useage

import Draggable from '@joyfulljs/draggable';

// ...
mount(){
  this.instance = new Draggable(this.refs.el);
},
active(){
  // if need to reset to origin state
  this.instance.reset()
},
unmount(){
  this.instance.destroy()
}
// ...

api

docs

tip

You can combine 'maxX/maxY/minX/minY' to achieve some special functionality.
for example:

  • set maxX=0 and minX=0 at the same time to make only draggable at y direction
  • set maxY=0 and minY=0 at the same time to make only draggable at x direction

Return false inside onMoving callback to prevent moving the element.

license

MIT

About

make element draggable for both touch device or mouse device

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published