public
Last active

  • Download Gist
jquery.drop.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
(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);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.