Draggable Elements is a JavaScript library that implements, as you may have guessed, draggable elements. This library is not aimed to be a replacement for jQuery UI's draggable widget, but is instead aimed to either run alongside it, or run completely independent of jQuery. It was made completely out of vanilla JavaScript, and as such has no dependencies. To get a feel for what a Draggable Element might look like, try throwing around the little box below.
1 | document.getElementById("demo").draggableElement({bounds: "parent", doY: false, inertia: true}); |
Draggable Elements are pretty customizable. The one on top has its boundaries set to its parent, its vertical movement turned off, and its inertia set to on (that inertia things is what lets it bounce off walls and get thrown around). And that happened all in one line of code. Now you've got a taste as to what this library has to offer.
There are other libraries out there that can provide similar functionality, but Draggable Elements is unique in a few ways:
Those are just few reasons why Draggable Elements is different from other libraries.
Click the download button below to download the script for your own use. There are minified and unminified versions to choose from. After downloading the script, follow the directions in the downloads section to link the script into your HTML document. Head over to the documentation page for instructions on how to use the script, or check out the demo page to see all the configurations.