Created
June 10, 2012 20:16
-
-
Save maccman/2907187 to your computer and use it in GitHub Desktop.
This file contains 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
(function($){ | |
function dragEnter(e) { | |
$(e.target).addClass("dragOver"); | |
e.stopPropagation(); | |
e.preventDefault(); | |
return false; | |
}; | |
function dragOver(e) { | |
e.originalEvent.dataTransfer.dropEffect = "copy"; | |
e.stopPropagation(); | |
e.preventDefault(); | |
return false; | |
}; | |
function dragLeave(e) { | |
$(e.target).removeClass("dragOver"); | |
e.stopPropagation(); | |
e.preventDefault(); | |
return false; | |
}; | |
$.fn.dropArea = function(){ | |
this.bind("dragenter", dragEnter). | |
bind("dragover", dragOver). | |
bind("dragleave", dragLeave); | |
return this; | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment