-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.html
243 lines (233 loc) · 9.76 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Selectbox Replacment Demo</title>
<link rel="stylesheet" href="jquery.sb.css" type="text/css" media="all" />
<style type="text/css">
body{font-size:13px;margin:8px;}
.outer_container{text-align:center;}
.inner_container{margin:0 auto;text-align:left;width:960px;}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="lib/jquerytie/jquery.tie.js"></script>
<script type="text/javascript" src="jquery.sb.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("[name=example], [name=example2], [name=example3], [name=example4], [name=example6], [name=os0], [name=example7]").sb({ ddCtx: function() { return $(this).closest("form"); } });
$("select[name=example]").append("<option value='8'>New Option</option>").sb("refresh");
// dynamic examples
$("[name=example5]").sb({ useTie: true });
$("[name=example5]").append("<option>dynamically added</option>");
$("[name=example5]").append("<option>and this one</option>");
setTimeout(function() {
$("[name=example5]").append("<option>this one is appended 5 seconds after load</option>");
}, 5000);
setTimeout(function() {
$("[name=example5]").empty().append("<option>10 seconds later, we remove stuff and add this one.</option><option>5 seconds later, the one above will be disabled</option>");
}, 10000);
setTimeout(function() {
$("[name=example5] option:first").attr("disabled", "disabled");
}, 15000);
$("select[name=example6]").sb({
displayFormat: function() {
if($(this).attr("label")) {
return $("<div>").append($($(this).attr("label")).filter("strong")).html();
}
return $(this).text();
}
});
$("[name=example8], [name=example9]").sb({
fixedWidth: true
});
$("[name=custom_markup_example]").sb({
optionFormat: function() {
return $(this).attr("alt");
}
});
});
</script>
</head>
<body>
<div class="outer_container">
<div class="inner_container" style="position:relative;">
<form action=".">
<div>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<h1 style="margin-top:0;">jquery.sb.js Selectbox Replacement</h1>
<h1>Demos</h1>
<div>
<select name="example2" class="round_sb" disabled="disabled">
<option>CT</option>
<option>DE</option>
<option>MA</option>
<option selected="selected">Disabled</option>
<option>NY</option>
<option>PA</option>
</select>
<select name="example" class="round_sb">
<option class="exampleOptionClass">Long dropdown test</option>
<option>Long dropdown test</option>
<optgroup label="Group 1">
<option>Blah</option>
<option>Rumor</option>
</optgroup>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<optgroup label="Group 2 long name long name">
<option disabled="disabled">Lorem ipsum</option>
<option>Whatever Whatever...</option>
</optgroup>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option class="exampleOptionClass">Long dropdown test</option>
<option>Long dropdown test</option>
<optgroup label="Disabled optgroup" disabled="disabled">
<option class="exampleOptionClass">Long dropdown test</option>
<option class="exampleOptionClass">Long dropdown test</option>
<option>Long dropdown test</option>
<option class="exampleOptionClass">Long dropdown test</option>
</optgroup>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option>Long dropdown test</option>
<option class="exampleOptionClass">Long dropdown test</option>
</select>
<input type="text" name="whatever" />
</div>
<select name="example3" class="round_sb">
<option>Test 1</option>
<option>Test 2</option>
<option>Test 3</option>
<option>Test 4</option>
<option disabled="disabled">Test 5</option>
</select><br/>
<label>State:
<select name="example4" class="round_sb">
<option>CT</option>
<option>DE</option>
<option>MA</option>
<option selected="selected">NJ</option>
<option>NY</option>
<option>PA</option>
</select>
</label><br/>
<label for="os0">Gift Certificate:</label>
<select name="os0" id="os0" class="round_sb">
<option value="Gift certificate 1 $50.00">Gift certificate 1 $50.00</option>
<option value="Gift certificate 2 $80.00">Gift certificate 2 $80.00</option>
<option value="Gift certificate 3 $100.00">Gift certificate 3 $100.00</option>
<option value="Gift certificate 4 $150.00">Gift certificate 4 $150.00</option>
<option value="Gift certificate 5 $200.00">Gift certificate 5 $200.00</option>
<option value="Gift certificate 6 $250.00">Gift certificate 6 $250.00</option>
<option value="Gift certificate 7 $300.00">Gift certificate 7 $300.00</option>
<option value="Gift certificate 8 $350.00">Gift certificate 8 $350.00</option>
<option value="Gift certificate 9 $400.00">Gift certificate 9 $400.00</option>
</select>
<br/>
<select name="example5" class="round_sb">
<option>abc</option>
<option>def</option>
</select>
<br/>
<select name="example6" class="round_sb">
<option>internal HTML test</option>
<option label="<strong>ttt</strong><br/><address>This is my address</address>">bolded</option>
</select>
<br/>
<select name="example7" class="round_sb">
</select>
<br/>
<select name="example8" class="fixed_width">
<option>short</option>
<option>this option is longer</option>
<option>but neither has an effect on width</option>
</select>
<select name="example9" class="fixed_width2">
<option>short</option>
<option>this option is longer</option>
<option>this example has a different width for the dropdown</option>
</select>
<br/>
<br/>
<br/>
<label>Custom Markup Example
<select name="custom_markup_example">
<option alt="<div><span style='background:red;display:inline-block;*display:inline;height:10px;width:10px;vertical-align:middle;zoom:1;'></span> line 1</div><div>line 2</div><div>line 3</div>">a</option>
<option alt="<div>another option</div>">b</option>
</select>
</label>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</div>
</form>
</div>
</div>
</body>
</html>