forked from FineUploader/fine-uploader
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved code for drag and drop, disabled drag and drop in safari (wh…
…ich worked incorrectly with multiple files)
- Loading branch information
Andrew Valums
committed
Aug 25, 2010
1 parent
b73dad6
commit c3fdfc3
Showing
3 changed files
with
173 additions
and
66 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<style> | ||
.drop-zone {height:100px; width:256px; background:gray; margin:20px;} | ||
</style> | ||
<script src="jquery-1.4.2.min.js" type="text/javascript"></script> | ||
<script src="../client/fileuploader.js" type="text/javascript" ></script> | ||
<script> | ||
|
||
function createDropZone(selector){ | ||
var element = $(selector)[0]; | ||
|
||
new qq.FileDropZone({ | ||
element: element, | ||
onEnter: function(){ | ||
console.log('enter') | ||
$(element).css('background', 'green'); | ||
}, | ||
onLeave: function(){ | ||
console.log('leave') | ||
}, | ||
onLeaveNotDescendants: function(){ | ||
console.log('onLeaveNotDescendants') | ||
$(element).css('background', 'gray'); | ||
}, | ||
onDrop: function(e){ | ||
$(element).css('background', 'gray'); | ||
console.log('drop'); | ||
console.log(e.dataTransfer.files); | ||
} | ||
}); | ||
} | ||
|
||
jQuery(function(){ | ||
createDropZone('#drop-zone1'); | ||
createDropZone('#drop-zone2'); | ||
}); | ||
|
||
</script> | ||
</head> | ||
<body> | ||
<div id="drop-zone1" class="drop-zone"><p>drop-zone1</p></div> | ||
<div id="drop-zone2" class="drop-zone"><p>drop-zone2</p></div> | ||
</body> | ||
</html> | ||
|
||
|
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