This repository has been archived by the owner on Jan 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.htm
397 lines (352 loc) · 9.68 KB
/
index.htm
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jQuery UI select menu</title>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css">
<style type="text/css">
<!--
.ui-selectmenu-area {
position : relative;
}
.ui-selectmenu-list {
list-style : none;
list-style-position : outside;
padding : 0px;
margin : 0px;
position : absolute;
overflow-y : auto;
text-align : left;
display : block;
visibility : hidden;
}
.ui-selectmenu-list ul {
list-style : none;
list-style-position : outside;
padding : 0px;
margin : 0px;
}
.ui-selectmenu-list li {
border : transparent 1px solid;
}
.ui-selectmenu-list .ui-widget-header {
padding : 3px;
font-variant : small-caps;
padding-left : 2px;
margin-bottom : 1px;
}
.ui-selectmenu-list li:not(.group) {
padding : 3px;
cursor : pointer;
}
.ui-selectmenu-list li.group li {
padding-left : 10px;
}
.past {
color : #999;
font-style : italic;
}
article {
top : 100px;
}
header {
position : absolute;
top : 0px;
left : 0px;
right : 0px;
}
footer {
position : absolute;
bottom : 0px;
left : 0px;
right : 0px;
}
body, td, th {
font-family : Arial, Helvetica, sans-serif;
font-size : 12px;
}
h1, h2, h3, h4 {
font-family : times, Times New Roman, times-roman, georgia, serif;
color : #444;
}
h1 {
margin : 20px 0 10px 0;
padding : 10px 0px 16px 0px;
text-shadow : 1px 1px 1px #000;
font-size : 46px;
line-height : 44px;
letter-spacing : -2px;
font-weight : bold;
text-align : left;
display : block;
background-color : white;
padding-left : 10px;
border-bottom : #e1e1e1 1px solid;
}
h1 span {
color : #f66;
}
h2 {
font-size : 22px;
}
table td {
padding : 5px;
border-bottom : #e1e1e1 1px dotted;
}
pre {
-moz-box-shadow : inset 0 0 10px rgba(0, 0, 0, 0.3);
-webkit-box-shadow : inset 0 0 10px rgba(0, 0, 0, 0.3);
box-shadow : inset 0 0 10px rgba(0, 0, 0, 0.3);
border : #999 1px solid;
padding : 10px;
}
-->
</style>
</head>
<body>
<h1>jQuery UI <span>select</span> menu</h1>
<select name="select1">
<option value="1">select 1</option>
<option value="2">select 2</option>
<option value="3">select 3</option>
<option value="4">select 4</option>
</select>
<h2>Usage</h2>
<pre>
$("select.down").selectmenu({
speed: 400,
maxHeight: 300,
direction: "auto",
width:"",
before: function(){ ... },
after: function(){ ... },
change: function(){ ... }
});
</pre>
<h2>Options</h2>
<table>
<tr>
<td>Option</td>
<td>Type</td>
<td>Description</td>
</tr>
<tr>
<td>Speed</td>
<td>numeric</td>
<td>animation speed (fade in/out)</td>
</tr>
<tr>
<td>maxHeight</td>
<td>numeric</td>
<td>the maximum height of the menu</td>
</tr>
<tr>
<td>direction</td>
<td>string</td>
<td>"up", "down", "auto" - if you dont want the menu to auto decide which way it must flip</td>
</tr>
<tr>
<td>width</td>
<td>numeric</td>
<td>if you want the menu to be a specific width. in pixels</td>
</tr>
<tr>
<td>before</td>
<td>function</td>
<td>before the menu stuff starts being rendered.. run this function</td>
</tr>
<tr>
<td>after</td>
<td>function</td>
<td>run this function after the menu has been setup</td>
</tr>
<tr>
<td>change</td>
<td>function</td>
<td>when an item has been selected... this is your function</td>
</tr>
</table>
<h2>Methods</h2>
<table>
<tr>
<td>$("select").selectmenu("position")</td>
<td>Resets the position of the menu. useful to combat the menu floating in the air if you hide some options
based on another menu
</td>
</tr>
<tr>
<td>$("select").selectmenu("destroy")</td>
<td>removes the menu... but before it does it burns all your friends for being mean to it :/</td>
</tr>
</table>
<h2>Examples</h2>
<table>
<tr>
<td colspan="2"><h3>Simple usage</h3></td>
</tr>
<tr>
<td>
<select name="select1">
<option value="1">select 1</option>
<option value="2">select 2</option>
<option value="3">select 3</option>
<option value="4">select 4</option>
</select>
</td>
<td>
<pre>
$("select[name='select1']").selectmenu();
</pre>
</td>
</tr>
<tr>
<td colspan="2"><h3>Few more options included</h3></td>
</tr>
<tr>
<td>
<select name="select2">
<option value="1">select 1</option>
<option value="2">select 2</option>
<option value="3">select 3</option>
<option value="4">select 4</option>
</select>
</td>
<td>
<pre>
$("select[name='select2']").selectmenu({
direction: "down",
speed:1000,
maxHeight:200,
change: function(){
alert("value: " + $(this).val() );
}
});
</pre>
</td>
</tr>
<tr>
<td colspan="2"><h3>Advanced</h3>the publication menu defines which date items should be shown. changing the
publication selects the next "future" date in the list
</td>
</tr>
<tr>
<td style="vertical-align:top; padding-top:20px;">
<select id="pID" name="pID">
<option value="4">Demo Publication 1</option>
<option value="5">Demo Publication 2</option>
<option value="6">Demo Publication 3</option>
</select>
<p></p>
<select id="dID" name="dID">
<optgroup label="future">
<option class="pub-5 future" value="83">83 | 14 January 2011</option>
<option class="pub-4 future" value="76">76 | 13 January 2011</option>
<option class="pub-5 future" value="82">82 | 07 January 2011</option>
<option class="pub-4 future" value="75">75 | 06 January 2011</option>
<option class="pub-5 future" value="81">81 | 31 December 2010</option>
<option class="pub-4 future" value="74">74 | 30 December 2010</option>
<option class="pub-6 future" value="13">13 | 01 December 2010</option>
</optgroup>
<optgroup label="past">
<option class="pub-5 past" value="80">80 | 24 December 2010</option>
<option class="pub-4 past" value="73">73 | 23 December 2010</option>
<option class="pub-5 past" value="67">67 | 17 December 2010</option>
<option class="pub-4 past" value="72">72 | 16 December 2010</option>
<option class="pub-5 past" value="66">66 | 10 December 2010</option>
<option class="pub-4 past" value="71">71 | 09 December 2010</option>
</optgroup>
</select>
<hr>
<div id="log"></div>
</td>
<td>
<pre>
var pID = $("#pID").val(), $dList = $("#dID-list");
$("#dID").selectmenu({
width:"240px",
direction : 'down',
before: function(){
$(this).val($("#dID option.pub-"+pID+".future:last").val() );
},
after: function(){
var pID = $("#pID").val();
$("#dID-list li:not(.group):not(.pub-"+pID+")").hide();
$("#dID-list li.pub-"+pID+"").show();
$(this).selectmenu("position");
},
change: function(){
$("#log").html("#"+$(this).attr("id") + " - " + $(this).val());
}
});
$("#pID").selectmenu({
//direction: "down",
change: function(){
var pID = $(this).val();
$("#dID-list li:not(.group):not(.pub-"+pID+")").hide();
$("#dID-list li.pub-"+pID+"").show();
$("#dID-list li.pub-"+pID+".future:last").addClass("selected").trigger("click");
$("#dID").selectmenu("position");
}
});
</pre>
</td>
</tr>
</table>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery.ui.selectmenu.js"></script>
<script language="javascript">
$(document).ready(function (){
$("select[name='select1']").selectmenu();
$("select[name='select2']").selectmenu({
direction: "down",
speed:1000,
maxHeight:200,
change: function(){
alert("value: "+$(this).val());
}
});
var pID=$("#pID").val(), $dList=$("#dID-list");
$("#dID").selectmenu({
width:"200px",
direction : 'down',
before: function(){
$(this).val($("#dID option.pub-"+pID+".future:last").val());
},
after: function(){
var pID=$("#pID").val();
$("#dID-list li:not(.group):not(.pub-"+pID+")").hide();
$("#dID-list li.pub-"+pID+"").show();
$(this).selectmenu("position");
},
change: function(){
$("#log").html("#"+$(this).attr("id")+" - "+$(this).val());
}
});
$("#pID").selectmenu({
//direction: "down",
change: function(){
var pID=$(this).val();
$("#dID-list li:not(.group):not(.pub-"+pID+")").hide();
$("#dID-list li.pub-"+pID+"").show();
$("#dID-list li.pub-"+pID+".future:last").addClass("selected").trigger("click");
$("#dID").selectmenu("position");
}
});
});
</script>
<script type="text/javascript">
var _gaq=_gaq||[];
_gaq.push(['_setAccount', 'UA-2827208-8']);
_gaq.push(['_trackPageview']);
(function(){
var ga=document.createElement('script');
ga.type='text/javascript';
ga.async=true;
ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';
var s=document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga,s);
})();
</script>
</body>
</html>