0.0.7 • Published 2 years ago

js-draggable-list v0.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

js-draggable-list

Make array elements draggable

Usage

HTML

<div id="content"></div>

JavaScript

import Draggable from 'js-draggable-list'

var drag = new Draggable({
  groupElement: document.getElementById('content'),
  dragElement: (e) => {
    return e.target
  },
  dragEnd: (pre, cur) => {
    ...
  }
})

When the component you created is destroyed, you need to destroy the drag(new Draggable)like this

drag.destroy()

Options

optiontypedefaultDescription
groupElementHTMLElement-List parent element
scrollElementHTMLElement-List scroll element. If not passed, the default is the same as the groupElement
dragElementFunction(e) => e.targetElement node selected when dragging
dragEndFunction(pre, cur) => {}The callback function when the drag is completed
cloneElementStyleObject{}The style of the mask element when dragging
cloneElementClassString''The class of the mask element when dragging
delayNumber300animation delay

methods

methodDescription
destroyDestroy the component and empty its contents
0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago