Skip to content

Instantly share code, notes, and snippets.

@maccman
Created June 10, 2012 20:16
Show Gist options
  • Save maccman/2907187 to your computer and use it in GitHub Desktop.
Save maccman/2907187 to your computer and use it in GitHub Desktop.
(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