kaguya-draggable
v1.0.12
Published
A js plugin to make any element able to be dragged.
Downloads
17
Readme
A simple plugin make your html element draggable!
- Install
NPM
$npm install kaguya-draggable
or
<script src="./../dist/draggable.js"></script>
- API
| key | value | description | | -------------------- |:--------------------------------:| ------------:| | selector | '.drag' | the root node | axis | 'both'/'x'/'y' | draggable axis | cursor | 'move' | the cursor style of selector | userSelect | boolean | userSelect of element | callback | function | get the coordinate
const drag = new Draggable({
selector: '#drag',
axis: 'both',
userSelect: false,
cursor: 'move',
callback: (data) => {
console.log(data);
},
});
or you can register nodelist by pass class or element selector
const drag = new Draggable({
selector: '.drag',
axis: 'both',
cursor: 'move',
});