-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
73 lines (72 loc) · 1.67 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>draggable.js</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script src="draggable.js"></script>
<style>
*{
margin: 0;
padding: 0;
}
li{
list-style: none;
}
.clearfix:after{
content: "\20";
display: block;
height: 0;
font-size: 0;
visibility: hidden;
clear: both;
}
.box{
width: 273px;
margin: 2em auto 0;
}
.block{
float: left;
width: 90px;
height: 150px;
margin-right: -1px;
margin-bottom: -1px;
margin: 10px;
border: 1px solid #000;
background-color: yellow;
line-height: 150px;
vertical-align: middle;
text-align: center;
font-size: 3em;
cursor: default;
transition: all 0.5s;
}
</style>
</head>
<body>
<div class="box">
<ul class="clearfix" id="dragBox">
<li class="block">01</li>
<li class="block"><a href="https://github.com/oodzchen/draggable.js" target="_blank">02</a></li>
<li class="block">03</li>
<li class="block">04</li>
<li class="block"><span>05</span></li>
<li class="block">06</li>
<li class="block">07</li>
<li class="block">08</li>
<li class="block">09</li>
</ul>
</div>
<script>
Draggable(document.getElementById("dragBox"), {
positioned: false,
onDrag: function(fromIndex, cloneElem){
console.log("drag", fromIndex, cloneElem);
},
onDrop: function(toIndex, dropElem){
console.log("drop", toIndex, dropElem);
}
});
</script>
</body>
</html>