Skip to content

Instantly share code, notes, and snippets.

@cristiandouce
Forked from maccman/jquery.drop.js
Created November 26, 2012 17:01
Show Gist options
  • Save cristiandouce/4149352 to your computer and use it in GitHub Desktop.
Save cristiandouce/4149352 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