Go to file
Kailash Nadh 041cdbb41c Bump version 2021-08-06 15:26:17 +05:30
docs Fix typo in boundary var in the demo 2021-08-06 15:25:39 +05:30
LICENSE First commit 2020-09-15 15:55:33 +05:30
README.md Fix typo in README 2020-10-22 13:38:20 +05:30
dragmove.js Stop the dragged element at the boundary 2021-07-30 09:58:22 +00:00
package.json Bump version 2021-08-06 15:26:17 +05:30

README.md

dragmove.js

A super tiny Javascript library to make DOM elements draggable and movable. Has touch screen support. Zero dependencies and 500 bytes Gzipped. Demo here.

Usage

Node

npm install @knadh/dragmove
import { dragmove } from @knadh/dragmove;

// (target, handler, onStart(target, x, y), onEnd(target, x, y)).
// onStart and onEnd are optional callbacks that receive target element, and x, y coordinates.

dragmove(document.querySelector("#box"), document.querySelector("#box .drag-handle"));

ES6 module

Check this example to include dragmove.js as a <script> directly on an HTML page.

Licensed under the MIT License.