drag-and-drop-list

Drag And Drop List Class

Usage no npm install needed!

<script type="module">
  import dragAndDropList from 'https://cdn.skypack.dev/drag-and-drop-list';
</script>

README

DragAndDropList javascript class

To make UL/LI HTML list dragAndDroped easily. It uses vanilla javascript.

Install

$ npm install drag-and-drop-list

Demo

Codepen Demo;

Local demo

$ npm run start

Example

import { DragAndDropList } from '../DragAndDropList.js';
    
const dndList = new DragAndDropList(); 
DragAndDropList.init();

Contructor Parameters

const dndList = new DragAndDropList(first, second);

  • first: ['replace'] || 'before' -> drag and drop mode
  • second: callbackFunction -> callback function to run when drag and drop finish