-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathditch_fabio.html
More file actions
69 lines (66 loc) · 2.33 KB
/
Copy pathditch_fabio.html
File metadata and controls
69 lines (66 loc) · 2.33 KB
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
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
#Fabio {
background-color: #FFF3CC;
border: #DFBC6A 1px solid;
width: 100px;
height: 100px;
padding: 8px;
font-size: 18px;
text-align: center;
}
#Trash_Can {
background-color: #CCC;
width: 200px;
height: 200px;
padding: 8px;
font-size: 18px;
text-align: center;
}
</style>
<script type="text/javascript">
var isRecycled = false;
function appStatus(msg) {
document.getElementById('app_status').innerHTML = msg;
}
// "e" represents the drag event in question for each drag function
function drag_start(e) {
appStatus("Dragging the " + e.target.getAttribute('id'));
e.dataTransfer.dropEffect = 'move';
e.dataTransfer.setData("text/plain", e.target.getAttribute('id'));
}
function drag_enter(e) {
appStatus("You are dragging over the " + e.target.getAttribute('id'));
}
function drag_leave(e) {
appStatus("You left the " + e.target.getAttribute('id'));
}
function drag_drop(e) {
var element = e.dataTransfer.getData("Text");
appStatus("Dropped " + element + " into the " + e.target.getAttribute('id'));
e.target.appendChild(document.getElementById(element));
isRecycled = true;
document.getElementById(element).removeAttribute("draggable");
}
function drag_end(e) {
var status = document.getElementById('app_status');
if (isRecycled == false) {
appStatus("You let the " + e.target.getAttribute('id') + " go.");
}
}
</script>
</head>
<body>
<h2>HTML5 Drag and Drop Demo For Trashing Fabio Soto</h2>
<h3 id="app_status">App status area ready...</h3>
<div id="Trash_Can" ondragenter="drag_enter(event)" ondrop="drag_drop(event)" ondragover="return false"
ondragleave="drag_leave(event)">
Trash Can
</div>
<hr/>
<div id="Fabio" draggable="true" ondragstart="drag_start(event)" ondragend="drag_end(event)">
Fabio Soto <img alt="Fucking Fabio" height="100" src="Iamcomingfor%20KURT.jpg" width="100"></div>
</body>
</html>