Skip to content

Instantly share code, notes, and snippets.

@dhc02
Forked from maccman/jquery.drop.js
Created March 14, 2013 06:21
Show Gist options
  • Save dhc02/5159245 to your computer and use it in GitHub Desktop.
Save dhc02/5159245 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