-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex-proto.html
85 lines (79 loc) · 2.47 KB
/
index-proto.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
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
<link rel="stylesheet" href="./css/styles.css">
<title>Test</title>
</head>
<body>
<h1>Native Drag and Drop</h1>
<small>Works only in modern browsers</small>
<ul id="list1">
<li draggable='true'>
<span>A</span>
</li>
<li draggable='true'>
<span>B</span>
</li>
<li draggable='true'>
<span>C</span>
</li>
</ul>
<ul id="list2">
<li draggable='true'>
<span>1</span>
</li>
<li draggable='true'>
<span>2</span>
</li>
<li draggable='true'>
<span>3</span>
</li>
<li draggable='true'>
<span>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</span>
</li>
</ul>
<ul id="list3">
<li draggable='true'>
<span>X</span>
</li>
<li draggable='true'>
<span>Y</span>
</li>
<li draggable='true'>
<span>Z</span>
</li>
</ul>
<script type="text/javascript" src='simplednd-proto.js'></script>
<script type="text/javascript">
var lists = document.querySelectorAll('ul');
var options1 = {
rootEl: lists[0],
dropZones: lists[0].querySelectorAll('li'),
draggable: lists[0].querySelectorAll('li')
};
var options2 = {
rootEl: lists[1],
dropZones: lists[1].querySelectorAll('li'),
draggable: lists[1].querySelectorAll('li')
};
var options3 = {
rootEl: lists[2],
dropZones: lists[2].querySelectorAll('li'),
draggable: lists[2].querySelectorAll('li'),
copyList: lists[0]
};
var simpleDnDList1 = Object.create(SimpleDnDList);
simpleDnDList1.init(options1);
var simpleDnDList2 = Object.create(SimpleDnDListWithRedBorder);
simpleDnDList2.init(options2);
var simpleDnDList3 = Object.create(SimpleDnDListWithRedBackground);
simpleDnDList3.init(options3);
</script>
</body>
</html>