Create simple drag-n-drop feature using Vanilla javascript – dragndrop.js

In this tutorial I am going to share awesome library written in Vanilla javascript – dragndrop.js Pure JS drag-n-drop for any binded DOM element. You can mixin behaviour with lib js-resizable. This plugin enables you to drag DOM elements within a boundary you specify.



Integrate drag-n-drop feature using Vanilla javascript – dragndrop.js

Libraries

Include plugin’s library on page.


HTML

Here is the sample html where drag and drop will work.

 
Content A

sub div

Sub-content A
Content B



CSS

Styling dragable element with background boundaries.

  

JS

Initialize the drag and drop plugin’s function.

 

See live demos and download source code.

DEMO | DOWNLOAD

Visit official github repository for more information and follow for future updates. Don’t forget to read license for using this plugin in your projects.