Skip to content

Commit c03b17b

Browse files
committed
Fix #54, Fix #59
1 parent a326bb9 commit c03b17b

11 files changed

+739
-576
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ $(function(){
310310
<td>Boolean</td>
311311
<td>Open select box on hover, instead of click</td>
312312
</tr>
313+
<tr>
314+
<td>hoverIntentTimeout</td>
315+
<td>500</td>
316+
<td>Integer</td>
317+
<td>Timeout to close options box after mouse leave plugin area</td>
318+
</tr>
313319
<tr>
314320
<td>expandToItemText</td>
315321
<td>false</td>
@@ -356,6 +362,12 @@ $(function(){
356362
<td>Boolean</td>
357363
<td>Inherit width from original element</td>
358364
</tr>
365+
<tr>
366+
<td>allowWrap</td>
367+
<td>true</td>
368+
<td>Boolean</td>
369+
<td>Determine if current selected option should jump to first (or last) once reach the end (of start) item of list upon keyboard arrow navigation.</td>
370+
</tr>
359371
</table>
360372

361373
##Events:

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jquery-selectric",
33
"description": "Fast, simple and light jQuery plugin to customize HTML selects",
4-
"version": "1.8.5",
4+
"version": "1.8.7",
55
"keywords": [
66
"select",
77
"selectbox",

dist/jquery.selectric.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
* /,'
1010
* /'
1111
*
12-
* Selectric Ϟ v1.8.6 (2014-10-14) - http://lcdsantos.github.io/jQuery-Selectric/
12+
* Selectric Ϟ v1.8.7 (2015-01-14) - http://lcdsantos.github.io/jQuery-Selectric/
1313
*
14-
* Copyright (c) 2014 Leonardo Santos; Dual licensed: MIT/GPL
14+
* Copyright (c) 2015 Leonardo Santos; Dual licensed: MIT/GPL
1515
*
1616
*/
1717

@@ -28,10 +28,12 @@
2828
arrowButtonMarkup: '<b class="button">&#x25be;</b>',
2929
disableOnMobile: true,
3030
openOnHover: false,
31+
hoverIntentTimeout: 500,
3132
expandToItemText: false,
3233
responsive: false,
3334
preventWindowScroll: true,
3435
inheritOriginalWidth: false,
36+
allowWrap: true,
3537
customClass: {
3638
prefix: pluginName,
3739
postfixes: classList,
@@ -205,14 +207,13 @@
205207

206208
$wrapper.add($original).add($outerWrapper).add($input).off(bindSufix);
207209

208-
209-
$outerWrapper.prop('class', [
210-
_this.classes.wrapper,
211-
_this.options.customClass.overwrite ?
212-
$original.prop('class').replace(/\S+/g, _this.options.customClass.prefix + '-$&') :
213-
$original.prop('class'),
214-
_this.options.responsive ? _this.classes.responsive : ''
215-
].join(' '));
210+
$outerWrapper.prop('class', [
211+
_this.classes.wrapper,
212+
_this.options.customClass.overwrite ?
213+
$original.prop('class').replace(/\S+/g, _this.options.customClass.prefix + '-$&') :
214+
$original.prop('class'),
215+
_this.options.responsive ? _this.classes.responsive : ''
216+
].join(' '));
216217

217218
if ( !$original.prop('disabled') ){
218219
isEnabled = true;
@@ -224,7 +225,7 @@
224225
// Delay close effect when openOnHover is true
225226
if ( _this.options.openOnHover ){
226227
clearTimeout(_this.closeTimer);
227-
e.type == 'mouseleave' ? _this.closeTimer = setTimeout(_close, 500) : _open();
228+
e.type == 'mouseleave' ? _this.closeTimer = setTimeout(_close, _this.options.hoverIntentTimeout) : _open();
228229
}
229230
});
230231

@@ -255,8 +256,15 @@
255256
// 38 => Up
256257
// 39 => Right
257258
// 40 => Down
258-
if ( key > 36 && key < 41 )
259+
if ( key > 36 && key < 41 ){
260+
if ( !_this.options.allowWrap ){
261+
if ( (key < 39 && selected == 0) || (key > 38 && (selected + 1) == _this.items.length) ){
262+
return;
263+
}
264+
}
265+
259266
_select(_utils[(key < 39 ? 'previous' : 'next') + 'EnabledItem'](_this.items, selected));
267+
}
260268
})
261269
.on('focusin' + bindSufix, function(e){
262270
// Stupid, but necessary... Prevent the flicker when

dist/jquery.selectric.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)