Drag and drop a file anywhere to upload
JavaScript HTML Makefile CSS
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
History.md
Makefile
Readme.md
component.json
drop-anywhere.css
example.html
index.js
package.json

Readme.md

drop-anywhere

Drag and drop files anywhere to upload.

Installation

$ component install component/drop-anywhere

Example

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.

@-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