Skip to content

Commit f2f7d49

Browse files
committed
Complete plugin code re-organization, added option preventWindowScroll, fix keyboard showing on mobile
1 parent 1fcc58f commit f2f7d49

File tree

8 files changed

+505
-416
lines changed

8 files changed

+505
-416
lines changed

README.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ Include **jQuery Selectric:**
2828
Put styles in your CSS and change it to your taste :D
2929

3030
```css
31-
/*======================================================================
32-
Selectric
33-
======================================================================*/
34-
3531
.selectricWrapper {
3632
position: relative;
3733
margin: 0 0 10px;
@@ -72,8 +68,7 @@ Put styles in your CSS and change it to your taste :D
7268
color: #BBB;
7369
text-align: center;
7470
font: 0/0 a;
75-
/* IE Fix */
76-
*font: 20px/30px Lucida Sans Unicode, Arial Unicode MS, Arial;
71+
*font: 20px/30px Lucida Sans Unicode,Arial Unicode MS,Arial;
7772
}
7873

7974
.selectric .button:after {
@@ -122,9 +117,6 @@ Put styles in your CSS and change it to your taste :D
122117
opacity: 0.5;
123118
cursor: default;
124119
-webkit-touch-callout: none;
125-
-webkit-user-select: none;
126-
-moz-user-select: none;
127-
-ms-user-select: none;
128120
user-select: none;
129121
}
130122

@@ -163,8 +155,6 @@ Put styles in your CSS and change it to your taste :D
163155
display: block !important;
164156
}
165157

166-
/* Items box */
167-
168158
.selectricItems {
169159
display: none;
170160
position: absolute;
@@ -174,12 +164,10 @@ Put styles in your CSS and change it to your taste :D
174164
background: #F9F9F9;
175165
border: 1px solid #CCC;
176166
z-index: 9998;
177-
-webkit-box-shadow: 0 0 10px -6px;
178167
box-shadow: 0 0 10px -6px;
179168
}
180169

181-
.selectricItems ul,
182-
.selectricItems li {
170+
.selectricItems ul,.selectricItems li {
183171
list-style: none;
184172
padding: 0;
185173
margin: 0;
@@ -277,12 +265,6 @@ $(function(){
277265
<td>Boolean</td>
278266
<td>Initialize plugin on mobile browsers</td>
279267
</tr>
280-
<tr>
281-
<td>border</td>
282-
<td>1</td>
283-
<td>Integer</td>
284-
<td>Options box border thickness</td>
285-
</tr>
286268
<tr>
287269
<td>openOnHover</td>
288270
<td>false</td>
@@ -322,15 +304,31 @@ $(function(){
322304

323305
If it's a function, it will be called with the following parameters: (itemData, element, index). The function must return a string, no keys will be replaced in this method.</td>
324306
</tr>
307+
<tr>
308+
<td>preventWindowScroll</td>
309+
<td>true</td>
310+
<td>Boolean</td>
311+
<td>Prevent scroll on window when using mouse wheel inside options box to match common browsers behavior.</td>
312+
</tr>
325313
</table>
326314

327315
##Public methods:
328316

329317
```js
330-
$('select').selectric('refresh'); // Reconstruct the instance of plugin
331-
$('select').selectric('destroy'); // Destroy Selectric and go back to normal
318+
var Selectric = $('select').data('selectric');
319+
320+
Selectric.open(); // Open options
321+
Selectric.close(); // Close options
322+
Selectric.destroy(); // Destroy select and go back to normal
323+
Selectric.refresh(); // Reconstruct the plugin options box
324+
Selectric.init(); // Reinitialize the plugin
325+
326+
// Or...
332327
$('select').selectric('open'); // Open options
333328
$('select').selectric('close'); // Close options
329+
$('select').selectric('destroy'); // Destroy select and go back to normal
330+
$('select').selectric('refresh'); // Reconstruct the plugin options box
331+
$('select').selectric('init'); // Reinitialize the plugin
334332
```
335333

336334
##Browser support:

0 commit comments

Comments
 (0)