-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
162 lines (146 loc) · 4.25 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SelectBox</title>
<link rel="stylesheet" href="css/selectBox.min.css">
<script type="text/javascript" src="//cdn.bootcss.com/jquery/1.12.0/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.selectBox.min.js"></script>
<style type="text/css">
#select1,
#select2,
#select3,
#select5,
#select6,
#select7 {
width: 120px;
margin-left: 20px;
float: left;
}
</style>
</head>
<body>
<div>
<select id="select1">
<option value="1">测试1-1</option>
<option value="2">测试1-2</option>
<option value="3" selected="selected">测试1-3</option>
</select>
<div id="select2">
<dl>
<dd data-id="1">测试2-1</dd>
<dd data-id="2">测试2-2</dd>
<dd data-id="3">测试2-3</dd>
</dl>
</div>
<div id="select3"></div>
<div id="select4" style="margin-left: 20px;"></div>
</div>
<div>
<select id="select5">
<optgroup label="测试1">
<option value="1">测试1-1</option>
<option value="2">测试1-2</option>
<option value="3">测试1-3</option>
</optgroup>
<optgroup label="测试11">
<option value="11-1">测试11-1</option>
<option value="11-2">测试11-2</option>
<option value="11-3">测试11-3</option>
</optgroup>
</select>
<div id="select6">
<dl data-label="测试1">
<dd data-id="1">测试2-1</dd>
<dd data-id="2">测试2-2</dd>
<dd data-id="3">测试2-3</dd>
</dl>
<dl data-label="测试21">
<dd data-id="11-1">测试21-1</dd>
<dd data-id="11-2">测试21-2</dd>
<dd data-id="11-3">测试21-3</dd>
</dl>
</div>
<div id="select7"></div>
<div id="select8" style="margin-left: 20px;"></div>
</div>
<script type="text/javascript">
var change = function (data) {
console.log('selected:', data);
};
var instance1 = $('#select1').selectBox({
change: change
});
var instance2 = $('#select2').selectBox({
change: change
});
var instance3 = $('#select3').selectBox({
change: change,
options: [
{text: '测试3-1', id: '1'},
{text: '测试3-2', id: '2'},
{text: '测试3-3', id: '3'}
]
});
var instance4 = $('#select4').selectBox({
change: change,
toggleArrow: true,
options: [
{text: '测试4-1 长文本测试 长文本测试 长文本测试', id: '1'},
{text: '测试4-2', id: '2'},
{text: '测试4-3', id: '3'}
]
});
var instance5 = $('#select5').selectBox({
change: change
});
var instance6 = $('#select6').selectBox({
change: change
});
var instance7 = $('#select7').selectBox({
change: change,
options: [
{
label: '分组1',
options: [
{text: '测试3-1', id: '1'},
{text: '测试3-2', id: '2'},
{text: '测试3-3', id: '3'}
]
},
{
label: '分组31',
options: [
{text: '测试31-1', id: '31-1'},
{text: '测试31-2', id: '31-2'},
{text: '测试31-3', id: '31-3'}
]
}
]
});
var instance8 = $('#select8').selectBox({
placeholder: '请选择',
change: change,
toggleArrow: true,
options: [
{
label: '分组1',
options: [
{text: '测试4-1', id: '1'},
{text: '测试4-2', id: '2'},
{text: '测试4-3', id: '3'}
]
},
{
label: '分组31',
options: [
{text: '测试41-1', id: '41-1'},
{text: '测试41-2', id: '41-2'},
{text: '测试41-3', id: '41-3'}
]
}
]
});
</script>
</body>
</html>