file-drops
A simple in-browser file drop utility
Last updated a year ago by nikku .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install file-drops 
SYNC missed versions from official npm registry.

file-drops

A simple in-browser file drop utility.

Usage

import fileDrop from 'file-drops';

const element = document.querySelector('#container');

const dropHandler = fileDrop('Drop a file', function(files) {
  // files = [ { name, contents }, ... ]
});

element.addEventListener('dragover', dropHandler);

Styling

On drop over, the utility will attach a the following overlay to the element for which the drop handler got registered:

<div class="drop-overlay">
  <div class="box">
    <div class="label">{label}</div>
  </div>
</div>

Style it as you wish. :heart:

License

MIT

Current Tags

  • 0.3.0                                ...           latest (a year ago)

4 Versions

  • 0.3.0                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 8
This Month 14
Last Day 0
Last Week 0
Last Month 9
Dependencies (1)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |