-
Notifications
You must be signed in to change notification settings - Fork 1
/
drag.html
114 lines (109 loc) · 2.25 KB
/
drag.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
108
109
110
111
112
113
114
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>拖拽排序</title>
<link type="text/css" rel="stylesheet" href="./commom/css/dragbox.css" />
</head>
<style>
.center {
margin: 0 auto;
}
</style>
<body>
<h1>width:100%</h1>
<div id="test1"></div>
<h1>width:400px</h1>
<div id="test2"></div>
<h1>inside</h1>
<div
style="
height: 60px;
width: 600px;
overflow-y: scroll;
padding-top: 100px;
"
>
<div id="test3"></div>
</div>
</body>
</html>
<script src="./commom/js/jquery-3.1.1.min.js"></script>
<script src="./commom/js/dragbox.js"></script>
<script>
/**
* option1
* */
option1 = {
dragbox: {
width: '100%',
fontSize: '16px',
backgroundColor: '#87cefa',
},
draglist: {
listSize: 6,
height: '60px',
data: [
'item1',
'item2',
'item3',
'item4',
'item5',
'item6',
'item7',
'item8',
'item9',
],
margin: '1.3%',
backgroundColor: ['#00ae9d', '#11264f', '#2570a1'],
},
}
let t1 = dragbox.init(document.getElementById('test1'))
t1.setOption(option1)
t1.bindFunction(test1, test2)
function test1() {
console.log(t1.getCurrentData())
console.log('执行第一个方法')
}
function test2() {
console.log('执行第二个方法')
}
/**
* option2
* */
option2 = {
dragbox: {
width: '600px',
fontSize: '16px',
backgroundColor: '#87cefa',
},
draglist: {
listSize: 4,
height: '30px',
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
margin: '1.9%',
backgroundColor: ['#00ae9d', '#11264f', '#2570a1'],
},
}
let t2 = dragbox.init(document.getElementById('test2'))
t2.setOption(option2)
/**
* option3
* */
option3 = {
dragbox: {
width: '100%',
fontSize: '16px',
backgroundColor: '#87cefa',
},
draglist: {
listSize: 4,
height: '30px',
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
margin: '2%',
backgroundColor: ['#00ae9d', '#11264f', '#2570a1'],
},
}
let t3 = dragbox.init(document.getElementById('test3'))
t3.setOption(option3)
</script>