-
Notifications
You must be signed in to change notification settings - Fork 75
/
demo-mini.html
42 lines (40 loc) · 988 Bytes
/
demo-mini.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>最小化demo</title>
<script type="text/javascript" src="../dist/dnd.js"></script>
<style>
html, body { width:100%; height:100%; }
body { margin:0; padding:20px; box-sizing:border-box; }
.drop { margin:20px auto; width:100%; height:100px; border:1px solid #000; }
.drag-box {
position: absolute;
width: 800px;
}
.drag-box .drag {
display: block;
width: 400px;
text-align: center;
background: #ccc;
}
</style>
</head>
<body>
<div class="drop"></div>
<div class="drag-box">
<span class="drag">拖动我到上方框框</span>
</div>
</body>
<script>
var Drag = dnd.Drag
var Drop = dnd.Drop
new Drag('.drag')
new Drop('.drop', {
onDrop: function (params) {
console.log(params)
params.el.appendChild(params.sourceNode)
}
})
</script>
</html>