A simple jquery plugin for creating styleable dropzones for files
$('#your-element').dropzone()to initiate (On any element, event the
drop-availableclass to the dropzone element when a file is being dragged to the window. This is useful if you want to style your element to show that it is possible to drop the file on it.
drop-overclass to the dropzone when the file is being dragged right over it.
Remember, you need to
preventDefault() on the 'drop' event, or the browser will use the default action on the dropped file, which is to download it or redirect to the file.
It's possible to instruct it to add an extra element inside the dropzone when a file is being dragged to the window,
which will also receive the
This is useful for creating a dropzone on
body, and having a styled dropzone element float above everything else.
This is done by passing an
Now just listen to 'drop' event and take the file:
The plugin will be automatically cleaned up when the
remove event is emitted (Either when jQuery.UI is present, or jquery.removeevent is present).
- Hi! I am Daniel Cohen Gindi. Or in short- Daniel.
- firstname.lastname@example.org is my email address.
- That's all you need to know.
I have invested, and investing, a lot of time in this project. If you want to help, you could:
- Actually code, and issue pull requests
- Test the library under different conditions and browsers
- Create more demo pages
- Spread the word
All the code here is under MIT license. Which means you could do virtually anything with the code. I will appreciate it very much if you keep an attribution where appropriate.
The MIT License (MIT) Copyright (c) 2013 Daniel Cohen Gindi (email@example.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.