@@ -28,6 +28,9 @@ Include **jQuery Selectric:**
28
28
Put styles in your CSS and change it to your taste : D
29
29
30
30
``` css
31
+ /* ======================================================================
32
+ Selectric
33
+ ======================================================================*/
31
34
.selectricWrapper {
32
35
position : relative ;
33
36
margin : 0 0 10px ;
@@ -45,7 +48,6 @@ Put styles in your CSS and change it to your taste :D
45
48
position : relative ;
46
49
border-radius : 2px ;
47
50
}
48
-
49
51
.selectric .label {
50
52
display : block ;
51
53
white-space : nowrap ;
@@ -57,7 +59,6 @@ Put styles in your CSS and change it to your taste :D
57
59
color : #444 ;
58
60
min-height : 18px ;
59
61
}
60
-
61
62
.selectric .button {
62
63
display : block ;
63
64
position : absolute ;
@@ -68,9 +69,9 @@ Put styles in your CSS and change it to your taste :D
68
69
color : #BBB ;
69
70
text-align : center ;
70
71
font : 0 /0 a;
71
- *font : 20px /30px Lucida Sans Unicode,Arial Unicode MS,Arial ;
72
+ /* IE Fix */
73
+ *font : 20px /30px Lucida Sans Unicode, Arial Unicode MS, Arial ;
72
74
}
73
-
74
75
.selectric .button :after {
75
76
content : " " ;
76
77
position : absolute ;
@@ -89,25 +90,20 @@ Put styles in your CSS and change it to your taste :D
89
90
.selectricHover .selectric {
90
91
border-color : #CCC ;
91
92
}
92
-
93
93
.selectricHover .selectric .button {
94
94
color : #888 ;
95
95
}
96
-
97
96
.selectricHover .selectric .button :after {
98
97
border-top-color : #888 ;
99
98
}
100
99
101
100
.selectricOpen {
102
101
z-index : 9999 ;
103
102
}
104
-
105
103
.selectricOpen .selectric {
106
104
border-color : #CCC ;
107
105
background : #F0F0F0 ;
108
- z-index : 9999 ;
109
106
}
110
-
111
107
.selectricOpen .selectricItems {
112
108
display : block ;
113
109
}
@@ -117,7 +113,10 @@ Put styles in your CSS and change it to your taste :D
117
113
opacity : 0.5 ;
118
114
cursor : default ;
119
115
-webkit-touch-callout : none ;
120
- user-select : none ;
116
+ -webkit-user-select : none ;
117
+ -moz-user-select : none ;
118
+ -ms-user-select : none ;
119
+ user-select : none ;
121
120
}
122
121
123
122
.selectricHideSelect {
@@ -126,7 +125,6 @@ Put styles in your CSS and change it to your taste :D
126
125
width : 0 ;
127
126
height : 0 ;
128
127
}
129
-
130
128
.selectricHideSelect select {
131
129
position : absolute ;
132
130
left : -100% ;
@@ -155,32 +153,33 @@ Put styles in your CSS and change it to your taste :D
155
153
display : block !important ;
156
154
}
157
155
156
+ /* Items box */
158
157
.selectricItems {
159
158
display : none ;
160
159
position : absolute ;
161
- overflow : auto ;
162
160
top : 100% ;
163
161
left : 0 ;
164
162
background : #F9F9F9 ;
165
163
border : 1px solid #CCC ;
166
- z-index : 9998 ;
164
+ z-index : -1 ;
167
165
box-shadow : 0 0 10px -6px ;
168
166
}
169
-
167
+ .selectricItems .selectricScroll {
168
+ height : 100% ;
169
+ overflow : auto ;
170
+ }
170
171
.selectricAbove .selectricItems {
171
172
top : auto ;
172
173
bottom : 100% ;
173
174
}
174
-
175
- .selectricItems ul ,.selectricItems li {
175
+ .selectricItems ul , .selectricItems li {
176
176
list-style : none ;
177
177
padding : 0 ;
178
178
margin : 0 ;
179
179
font-size : 12px ;
180
180
line-height : 20px ;
181
181
min-height : 20px ;
182
182
}
183
-
184
183
.selectricItems li {
185
184
display : block ;
186
185
padding : 5px ;
@@ -189,18 +188,15 @@ Put styles in your CSS and change it to your taste :D
189
188
color : #666 ;
190
189
cursor : pointer ;
191
190
}
192
-
193
191
.selectricItems li .selected {
194
192
background : #EFEFEF ;
195
193
color : #444 ;
196
194
border-top-color : #E0E0E0 ;
197
195
}
198
-
199
196
.selectricItems li :hover {
200
197
background : #F0F0F0 ;
201
198
color : #444 ;
202
199
}
203
-
204
200
.selectricItems li .disabled {
205
201
background : #F5F5F5 ;
206
202
color : #BBB ;
@@ -228,27 +224,53 @@ $(function(){
228
224
<td><strong>Type</strong></td>
229
225
<td><strong>Description</strong></td>
230
226
</tr >
227
+ <tr >
228
+ <td>onBeforeInit</td>
229
+ <td><pre><code>function(element) {}</code></pre></td>
230
+ <td>Function</td>
231
+ <td>Function called before plugin initialize</td>
232
+ </tr >
233
+ <tr >
234
+ <td>onInit</td>
235
+ <td><pre><code>function(element) {}</code></pre></td>
236
+ <td>Function</td>
237
+ <td>Function called plugin has been fully initialized</td>
238
+ </tr >
239
+ <tr >
240
+ <td>onBeforeOpen</td>
241
+ <td><pre><code>function(element) {}</code></pre></td>
242
+ <td>Function</td>
243
+ <td>Function called before select options opens</td>
244
+ </tr >
231
245
<tr >
232
246
<td>onOpen</td>
233
- <td>function() {}</td>
247
+ <td><pre><code> function(element ) {}</code></pre> </td>
234
248
<td>Function</td>
235
- <td>Function called when select options open </td>
249
+ <td>Function called after select options opens </td>
236
250
</tr >
237
251
<tr >
238
- <td>onChange </td>
239
- <td>function() {}</td>
252
+ <td>onBeforeClose </td>
253
+ <td><pre><code> function(element ) {}</code></pre> </td>
240
254
<td>Function</td>
241
- <td>Function called when select options change </td>
255
+ <td>Function called before select options closes </td>
242
256
</tr >
243
257
<tr >
244
258
<td>onClose</td>
245
- <td>function() {}</td>
259
+ <td><pre><code> function(element ) {}</code></pre> </td>
246
260
<td>Function</td>
247
- <td>Function called when select options close</td>
261
+ <td>Function called after select options closes</td>
262
+ </tr >
263
+ <tr >
264
+ <td>onChange</td>
265
+ <td><pre><code>function(element) {
266
+   ;  ; $(element).change();
267
+ }</code ></pre ></td >
268
+ <td >Function</td >
269
+ <td >Function called when select options change</td >
248
270
</tr >
249
271
<tr >
250
272
<td>onRefresh</td>
251
- <td>function() {}</td>
273
+ <td><pre><code> function(element ) {}</code></pre> </td>
252
274
<td>Function</td>
253
275
<td>Function called when the Selectric is refreshed</td>
254
276
</tr >
@@ -329,6 +351,65 @@ $(function(){
329
351
</tr >
330
352
</table >
331
353
354
+ ##Events
355
+
356
+ All events are called on original element, first argument is the original element too. And can be bound like this:
357
+
358
+ ``` js
359
+ $ (' select' ).on (' selectric-eventname' , function (element ){
360
+ // your code
361
+ });
362
+ ```
363
+
364
+ ` eventname ` can be one of the following:
365
+
366
+ <table >
367
+ <tr >
368
+ <td><strong>Event name</strong></td>
369
+ <td><strong>Description</strong></td>
370
+ </tr >
371
+
372
+ <tr >
373
+ <td><code>selectric-before-init</code></td>
374
+ <td>Fired before plugin initialize</td>
375
+ </tr >
376
+
377
+ <tr >
378
+ <td><code>selectric-init</code></td>
379
+ <td>Fired plugin has been fully initialized</td>
380
+ </tr >
381
+
382
+ <tr >
383
+ <td><code>selectric-before-open</code></td>
384
+ <td>Fired before select options opens</td>
385
+ </tr >
386
+
387
+ <tr >
388
+ <td><code>selectric-open</code></td>
389
+ <td>Fired after select options opens</td>
390
+ </tr >
391
+
392
+ <tr >
393
+ <td><code>selectric-before-close</code></td>
394
+ <td>Fired before select options closes</td>
395
+ </tr >
396
+
397
+ <tr >
398
+ <td><code>selectric-close</code></td>
399
+ <td>Fired after select options closes</td>
400
+ </tr >
401
+
402
+ <tr >
403
+ <td><code>selectric-change</code></td>
404
+ <td>Fired when select options change</td>
405
+ </tr >
406
+
407
+ <tr >
408
+ <td><code>selectric-refresh</code></td>
409
+ <td>Fired when the Selectric is refreshed</td>
410
+ </tr >
411
+ </table >
412
+
332
413
##Public methods:
333
414
334
415
``` js
0 commit comments