Drag and drop files anywhere to upload.
$ component install component/drop-anywhere
var dropAnywhere = require('drop-anywhere');
var drop = dropAnywhere(function(e){
e.items.forEach(function(item){
console.log(item);
});
});
Unbind event handlers.
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.
@-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;
}
MIT