Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/drop-anywhere
Drag and drop a file anywhere to upload
https://github.com/component/drop-anywhere
Last synced: 12 days ago
JSON representation
Drag and drop a file anywhere to upload
- Host: GitHub
- URL: https://github.com/component/drop-anywhere
- Owner: component
- Created: 2013-02-05T22:14:56.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-03-16T19:00:25.000Z (almost 10 years ago)
- Last Synced: 2024-11-14T21:49:19.885Z (about 1 month ago)
- Language: JavaScript
- Size: 202 KB
- Stars: 21
- Watchers: 7
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# drop-anywhere
Drag and drop files anywhere to upload.
## Installation
$ component install component/drop-anywhere
## Example
```js
var dropAnywhere = require('drop-anywhere');var drop = dropAnywhere(function(e){
e.items.forEach(function(item){
console.log(item);
});
});
```## API
### DropAnywhere#unbind()
Unbind event handlers.
## Example CSS
The classname `.show` is added when a user triggers a dragstart event. By
default `#drop-anywhere` is stretched 100% horizontally and vertically, with
a semi-transparent background.```css
@-webkit-keyframes show {
from {
opacity: 0;
}
to {
opacity: 1;
}
}body {
text-align: center;
}#drop-anywhere {
line-height: 500px;
text-align: center;
color: white;
display: none;
}#drop-anywhere::before {
content: 'Drop to upload!';
}#drop-anywhere.show {
-webkit-animation: show 300ms;
}
```## License
MIT