Last active
December 23, 2015 11:19
-
-
Save DustinHigginbotham/6627798 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Dropzone = function(selector, options) { | |
| this.elm = document.querySelector(selector); | |
| var onDragOver = function(e) { | |
| e.preventDefault(); | |
| if (options.onDragOver) { | |
| options.onDragOver(e); | |
| } | |
| return false; | |
| }; | |
| this.elm.ondragover = onDragOver; | |
| var onDragEnd = function(e) { | |
| e.preventDefault(); | |
| if (options.onDragEnd) { | |
| options.onDragEnd(e); | |
| } | |
| return false | |
| }; | |
| this.elm.ondragend = onDragEnd; | |
| var onDrop = function(e) { | |
| e.preventDefault(); | |
| if (options.onDrop) { | |
| options.onDrop(e); | |
| } | |
| return false; | |
| }; | |
| this.elm.ondrop = onDrop; | |
| }; | |
| Dropzone.prototype.destroy = function() { | |
| this.elm.ondragover = null; | |
| this.elm.ondragend = null; | |
| this.elm.ondrop = null; | |
| }; |
astrotars
commented
Sep 19, 2013
Author
Thanks, Nick! Updated the GIST
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment