@joyfulljs/draggable
v1.0.6
Published
make element draggable
Downloads
2
Readme
make element draggable
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
tip
You can combine 'maxX/maxY/minX/minY' to achieve some special functionality.
for example:
- set
maxX=0
andminX=0
at the same time to make only draggable at y direction - set
maxY=0
andminY=0
at the same time to make only draggable at x direction
Return false
inside onMoving
callback to prevent moving the element.
LICENSE
MIT