Created
September 18, 2012 21:57
-
-
Save chrisallick/3746185 to your computer and use it in GitHub Desktop.
check x and y to handle leave event properly drag and drop html5
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
$('#draganddrop-wrapper').hide(); | |
$(document).bind('dragenter', function(event) { | |
$('#draganddrop-wrapper').fadeIn(500); | |
return false; | |
}); | |
$("#draganddrop-wrapper").bind('dragover', function(event) { | |
return false; | |
}).bind('dragleave', function(event) { | |
if( window.event.pageX == 0 || window.event.pageY == 0 ) { | |
$(this).fadeOut(500); | |
return false; | |
} | |
}).bind('drop', function(event) { | |
handleDrop(event); | |
$(this).fadeOut(500); | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment