Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/drag-and-drop-files
Handle file drag-and-drop events without all the Yak shaving
https://github.com/mikolalysenko/drag-and-drop-files
Last synced: about 2 months ago
JSON representation
Handle file drag-and-drop events without all the Yak shaving
- Host: GitHub
- URL: https://github.com/mikolalysenko/drag-and-drop-files
- Owner: mikolalysenko
- License: mit
- Created: 2013-07-20T00:12:51.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-26T07:11:11.000Z (almost 9 years ago)
- Last Synced: 2024-10-20T14:27:20.866Z (2 months ago)
- Language: JavaScript
- Size: 37.1 KB
- Stars: 55
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
drag-and-drop-files
===================
Handle [file drag and drop events](https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications) in an HTML5 capable browser with less Yak shaving.## Example
```javascript
var dropTarget = document.querySelector("#dropTarget")require("drag-and-drop-files")(dropTarget, function(files) {
console.log("Got some files:", files)
})
```## Install
npm install drag-and-drop-files
### `require("drag-and-drop-files")(element, callback(files) )`
Hooks a listener for a file data transfer event.* `element` is the DOM element to listen for file events on
* `callback(files)` is a callback that gets fired when the files are dropped on to it. The argument `files` is an array of all the file objects that were dragged onto the element.## Credits
(c) 2013 Mikola Lysenko. MIT License