https://github.com/smithg09/draggerjs
A tiny JS library to make DOM elements draggable and movable with Zero dependencies
https://github.com/smithg09/draggerjs
Last synced: 2 months ago
JSON representation
A tiny JS library to make DOM elements draggable and movable with Zero dependencies
- Host: GitHub
- URL: https://github.com/smithg09/draggerjs
- Owner: smithg09
- License: mit
- Created: 2023-07-30T20:06:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-30T20:13:02.000Z (almost 2 years ago)
- Last Synced: 2025-02-08T01:51:43.729Z (4 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dragger.js
A tiny JS library to make DOM elements draggable and movable with Zero dependencies. [Demo here](https://dragger.smithgajjar.dev/).
## Usage
```javascript
import { dragger } from @smithg09/dragger;// (target, handler, onDragStart(target, x, y), onDragEnd(target, x, y)).
// onDragStart and onDragEnd are optional callbacks that receive target element, and x, y coordinates.dragger(document.querySelector("#dragBox"), document.querySelector("#dragBox .drag-handler"));
```### ES6 module
[Check this example](https://github.com/smithg09/draggerjs/blob/main/docs/index.html) to include dragger.js as a `` directly on an HTML page.Licensed under the MIT License.