Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

mfuu/js-draggable-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is no longer maintained, see another project for more, click here!!!

Downloads Version

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

option type default Description
groupElement HTMLElement - List parent element
scrollElement HTMLElement - List scroll element. If not passed, the default is the same as the groupElement
dragElement Function (e) => e.target Element node selected when dragging
dragEnd Function (pre, cur) => {} The callback function when the drag is completed
cloneElementStyle Object {} The style of the mask element when dragging
cloneElementClass String '' The class of the mask element when dragging
delay Number 300 animation delay

methods

method Description
destroy Destroy the component and empty its contents

About

Make array elements draggable

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published