1.0.12 • Published 6 years ago
kaguya-draggable v1.0.12
A simple plugin make your html element draggable!
- Install
NPM
$npm install kaguya-draggableor
<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',
    });