aboutsummaryrefslogtreecommitdiffstats
path: root/addon/js_upload/file-uploader/tests/test-drop-zone.htm
blob: d7f0accf7cf7114708bf664d20675300954a00e9 (plain) (blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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.UploadDropZone({
        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>