-
Notifications
You must be signed in to change notification settings - Fork 5
/
demo.html
85 lines (80 loc) · 2.28 KB
/
demo.html
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<body>
<div id="info"></div>
<div id="dragbox" draggable="true">Drag me</div>
<div id="outerDropzone">
<div id="text"></div>
<div id="innerDropzone">
Drop here
</div>
</div>
<style>
#dragbox {
height: 80px;width: 80px;
background-color: green;
}
#outerDropzone {
position: relative;
height: 100px;width: 200px;
background-color: orangered;
}
#text {
position: absolute;
}
#innerDropzone {
position: absolute;
margin: 25px;
height: 50px;width: 150px;
background-color: dodgerblue;
}
</style>
<script src="dist/dripDrop-dev.umd.js"></script>
<script>
var dragbox = document.getElementById("dragbox")
var outerDropzone = document.getElementById("outerDropzone")
var outerDropzoneText = document.getElementById("text")
var innerDropzone = document.getElementById("innerDropzone")
dripDrop.drag(dragbox, {
image: true, // default drag image
start: function(setData, e) {
setData('myCustomData', JSON.stringify({a:1, b:"NOT THE BEES"})) // camel case types are allowed!*
dragbox.innerHTML = 'dragging started'
},
move: function() {
dragbox.innerHTML = 'dragging..'
},
end: function() {
dragbox.innerHTML = 'drug'
}
})
dripDrop.drop(outerDropzone, {
enter: function() {
outerDropzoneText.innerHTML = 'hi'
},
move: function(data, e) {
outerDropzoneText.innerHTML += '.'
},
leave: function() {
outerDropzoneText.innerHTML = 'bye'
},
drop: function() {
outerDropzoneText.innerHTML = "I don't want this junk!"
}
})
dripDrop.drop(innerDropzone, {
enter: function() {
innerDropzone.innerHTML = 'hi'
},
move: function(data, e) {
e.stopPropagation()
innerDropzone.innerHTML += '.'
},
leave: function() {
innerDropzone.innerHTML = 'bye'
},
drop: function(data, e) {
e.stopPropagation()
innerDropzone.innerHTML = data.myCustomData
}
})
</script>
</body>