Skip to content

Instantly share code, notes, and snippets.

@pinzolo
Created April 10, 2014 14:01
Show Gist options
  • Save pinzolo/10385452 to your computer and use it in GitHub Desktop.
Save pinzolo/10385452 to your computer and use it in GitHub Desktop.
File API を実装しているブラウザにて、ファイルのドラッグアンドドロップを処理する
if (window.File) {
$("#fileDrop").on('dragenter', function (e) {
e.stopPropagation();
e.preventDefault();
j$(this).addClass('fileOver');
}).on('dragover', function (e) {
e.stopPropagation();
e.preventDefault();
}).on('drop', function (e) {
$(this).removeClass('fileOver');
e.preventDefault();
// upload process
uploadFiles(e.originalEvent.dataTransfer.files);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment