-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
107 lines (100 loc) · 3.11 KB
/
index.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Learn Drag n Drop events</title>
<link rel="stylesheet" href="style.css" />
<style>
* {
box-sizing: border-box;
font-family: "Trebuchet MS", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
color: #222;
}
#app {
max-width: 768px;
margin: 0 auto;
}
h1 {
text-align: center;
}
</style>
</head>
<body>
<div id="app">
<h1>JS Drag and Drop <a href="https://github.com/hta218/dnd-keynotes" target="_blank">keynotes</a></h1>
<br><br><br>
<h2>Example 1 - Simple drag n drop events</h2>
<div class="example-parent ex1">
<div class="example-origin">
<div id="draggable-1" class="example-draggable" draggable="true">
Draggable 1
</div>
<div id="draggable-2" class="example-draggable" draggable="true">
Draggable 2
</div>
</div>
<div class="example-dropzone">
dropzone
</div>
</div>
<br><br>
<h2>Example 2 - Swap 2 draggable elements</h2>
<div class="example-parent ex3 advanced">
<div class="example-origin">
To-do
<div id="drag-item-1" class="example-draggable gray" draggable="true">
Do homework
</div>
<div id="drag-item-2" class="example-draggable orange" draggable="true">
Grab some food at the supermarket
</div>
<div id="drag-item-3" class="example-draggable yellow" draggable="true">
Clean up the working desk
</div>
<div id="drag-item-4" class="example-draggable green" draggable="true">
Feed the dogs
</div>
<div id="drag-item-5" draggable="true" class="example-draggable blue">
Code
</div>
</div>
</div>
<br><br>
<h2>Example 3 - Move element</h2>
<div class="example-parent ex4 advanced">
<div class="example-origin">
To-do
<div class="wrapper" data-index="0">
<div id="drag-item-1" draggable="true" class="example-draggable gray">Do homework
</div>
</div>
<div class="wrapper" data-index="1">
<div id="drag-item-2" draggable="true" class="example-draggable orange">Grab some food at the supermarket
</div>
</div>
<div class="wrapper" data-index="2">
<div id="drag-item-3" draggable="true" class="example-draggable yellow">Clean up the working desk</div>
</div>
<div class="wrapper" data-index="3">
<div id="drag-item-4" draggable="true" class="example-draggable green">Feed the dogs</div>
</div>
<div class="wrapper" data-index="4">
<div id="drag-item-5" draggable="true" class="example-draggable blue">Code</div>
</div>
</div>
</div>
<br><br><br>
<p class="footer">
Copyright 2020 - Made by Leo Huynh at:
<a href="https://leohuynh.dev" target="_blank">https://leohuynh.dev</a>,
<a href="https://twitter.com/hta218_" target="_blank">@twitter/hta218_</a>,
<a href="https://github.com/hta218" target="_blank">@github/hta218</a>
</p>
<br>
</div>
<script src="./script.js"></script>
<script src="./dnd-swap.js"></script>
<script src="./dnd-move.js"></script>
</body>
</html>