-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathindex.html
280 lines (260 loc) · 9.12 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
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
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Easy Selectbox - jQuery Plugin</title>
<meta name="description" content="Easy Selectbox" />
<meta name="keywords" content="Easy Selectbox" />
<link rel="stylesheet" type="text/css" media="screen" href="easyselectbox/easyselectbox.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="easyselectbox/easyselectbox.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//example 1
$('#example-1').easySelectBox();
//example 2
$('#example-2').easySelectBox({speed:100});
//example 3
$('#example-3').easySelectBox();
$('#example-3-0').click(function(e){
$('#example-3').easySelectBox( "option", "index", 0 );
e.preventDefault();
});
$('#example-3-1').click(function(e){
$('#example-3').easySelectBox( "option", "index", 1 );
e.preventDefault();
});
$('#example-3-2').click(function(e){
$('#example-3').easySelectBox( "option", "index", 2 );
e.preventDefault();
});
//example 4
$('#example-4').easySelectBox();
$('#example-4-enable').click(function(e){
$('#example-4').easySelectBox( "option", "disabled", false );
e.preventDefault();
});
$('#example-4-disable').click(function(e){
$('#example-4').easySelectBox( "option", "disabled", true );
e.preventDefault();
});
$('#sample5').easySelectBox({
onBuildList:function(data){
var dropdownHtml = '<div class="esb-dropdown esb-dropdown-sample5">';
var itemsPerCol = 2;
$.each(data.lists, function(i, el){
if(i%itemsPerCol==0){
dropdownHtml += '<div class="esb-column">';
}
dropdownHtml += '<div class="esb-item">'+$(el).text()+'</div>';
if((i+1)%itemsPerCol==0){
dropdownHtml += '</div>';
}
});
dropdownHtml += '<div class="clear"></div></div>';
return dropdownHtml;
}
});
$('#sample6').easySelectBox({speed:'fast'});
$('#sample6-open').click(function(){
$('#sample6').easySelectBox('open', true);//set persistent to true and dropdown will remain open even when losing focus, unless closed explicitly
return false;
});
$('#sample6-close').click(function(){
$('#sample6').easySelectBox('close');
return false;
});
$('#sample7').easySelectBox({speed:100});
$('#sample7-select-1').click(function(){
$('#sample7').easySelectBox('select', 'New York');
return false;
});
$('#sample7-select-2').click(function(){
$('#sample7').easySelectBox('select', 'Vancouver');
return false;
});
$('#sample7-select-3').click(function(){
$('#sample7').easySelectBox('select', '');
return false;
});
$('#sample7-select-4').click(function(){
$('#sample7').easySelectBox('select', 'Washington', true);//useValue = true
return false;
});
});
</script>
</head>
<body>
<div id="wrapper">
<h1>Easy Select Box</h1>
<form id="form1" method="post" action="">
<div class="entry-example">
<h2>Example 1 - Default</h2>
<pre>$('#example-1').easySelectBox();</pre>
<label for="example-1">Civil Status:</label>
<select name="status" id="example-1">
<option value="1">Single</option>
<option value="2">Married</option>
<option value="3">Divorced</option>
</select>
</div>
<div class="entry-example">
<h2>Example 2 - Speed</h2>
<p>Here we specify the speed of dropdown in milliseconds.</p>
<pre>$('#example-2').easySelectBox({speed:100});</pre>
<label for="example-2">Categories:</label>
<select name="categories" id="example-2">
<option>All Books</option>
<option>Best Sellers</option>
<option>Biography</option>
<option>Suspense</option>
</select>
</div>
<div class="entry-example">
<h2>Example 3 - Set Value of Select by Index</h2>
<pre>$('#example-3').easySelectBox();
$('#example-3-0').click(function(e){
$('#example-3').easySelectBox( "option", "index", 0 );
e.preventDefault();
});
$('#example-3-1').click(function(e){
$('#example-3').easySelectBox( "option", "index", 1 );
e.preventDefault();
});
$('#example-3-2').click(function(e){
$('#example-3').easySelectBox( "option", "index", 2 );
e.preventDefault();
});
</pre>
<label for="example-3">Sample Dropdown:</label>
<select name="example_3" id="example-3">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
<a href="#" id="example-3-0">Set index to 0</a> |
<a href="#" id="example-3-1">Set index to 1</a> |
<a href="#" id="example-3-2">Set index to 2</a>
</div>
<div class="entry-example">
<h2>Example 4 - Enable/Disable</h2>
<p>There are variety of ways to disable the select. One is by specifying <strong>disabled="disabled"</strong> in the select element itself.</p>
<pre><select <strong>disabled="disabled"</strong> name="sample4" id="sample4">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
</pre>
<p>You can also set it as a parameter of the plugin:</p>
<pre>$('#example-4').easySelectBox({disabled:true});</pre>
<p>Or by setting it after the plugin was initialized. Below is a script that will disable/enable the select:</p>
<pre>$('#example-4').easySelectBox();
$('#example-4-enable').click(function(e){
$('#example-4').easySelectBox( "option", "disabled", false );
e.preventDefault();
});
$('#example-4-disable').click(function(e){
$('#example-4').easySelectBox( "option", "disabled", true );
e.preventDefault();
});
</pre>
<label for="example-4">Sample Dropdown:</label>
<select disabled="disabled" name="example_4" id="example-4">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
<a href="#" id="example-4-enable">Enable</a> |
<a href="#" id="example-4-disable">Disable</a>
</div>
<div class="entry-example">
<h2>Example 5 - onBuildList</h2>
<p>Here we used the onBuildList callback to build a list. The list is grouped into columns containing 2 items each.</p>
<pre>$('#sample5').easySelectBox({
onBuildList:function(data){
var dropdownHtml = '<div class="esb-dropdown esb-dropdown-sample5">';
var itemsPerCol = 2;
$.each(data.lists, function(i, el){
if(i%itemsPerCol==0){
dropdownHtml += '<div class="esb-column">';
}
dropdownHtml += '<div class="esb-item">'+$(el).text()+'</div>';
if((i+1)%itemsPerCol==0){
dropdownHtml += '</div>';
}
});
dropdownHtml += '<div class="clear"></div></div>';
return dropdownHtml;
}
});
</pre>
<label for="sample5">Custom Build List:</label>
<select name="sample5" id="sample5">
<option value="1">Argentina</option>
<option value="2">Brazil</option>
<option value="3">China</option>
<option value="4">Denmark</option>
<option value="5">Ecuador</option>
<option value="6">Finland</option>
</select>
</div>
<div class="entry-example">
<h2>Example 6 - Open and close method</h2>
<pre>$('#sample6').easySelectBox({speed:'fast'});
$('#sample6-open').click(function(){
$('#sample6').easySelectBox('open', true);//set persistent to true and dropdown will remain open even when losing focus, unless closed explicitly
return false;
});
$('#sample6-close').click(function(){
$('#sample6').easySelectBox('close');
return false;
});
</pre>
<label for="sample6">Civil Status:</label>
<select name="sample6" id="sample6">
<option value="1">Single</option>
<option value="2">Married</option>
<option value="3">Divorced</option>
</select>
<a href="#" id="sample6-open">Open select box </a> |
<a href="#" id="sample6-close">Close select box </a>
</div>
<div class="entry-example">
<h2>Example 7 - Select method</h2>
<pre>$('#sample7').easySelectBox({speed:100});
$('#sample7-select-1').click(function(){
$('#sample7').easySelectBox('select', 'New York');
return false;
});
$('#sample7-select-2').click(function(){
$('#sample7').easySelectBox('select', 'Vancouver');
return false;
});
$('#sample7-select-3').click(function(){
$('#sample7').easySelectBox('select', '');
return false;
});
$('#sample7-select-4').click(function(){
$('#sample7').easySelectBox('select', 'Washington', true);//useValue = true
return false;
});
</pre>
<label for="sample7">Civil Status:</label>
<select name="sample7" id="sample7">
<option></option>
<option>Atlanta</option>
<option>New York</option>
<option>Vancouver</option>
<option value="Washington">Washington DC</option>
</select>
<a href="#" id="sample7-select-1">New York </a> |
<a href="#" id="sample7-select-2">Vancouver</a> |
<a href="#" id="sample7-select-3">Blank</a> |
<a href="#" id="sample7-select-4">Washington</a>
</div>
</form>
</div>
<!-- /wrapper -->
</body>
</html>