|
9 | 9 | * /,'
|
10 | 10 | * /'
|
11 | 11 | *
|
12 |
| - * Selectric Ϟ v1.4.6 |
| 12 | + * Selectric Ϟ v1.4.7 |
13 | 13 | *
|
14 | 14 | * Copyright (c) 2013 Leonardo Santos; Dual licensed: MIT/GPL
|
15 | 15 | *
|
|
65 | 65 | function _start(){
|
66 | 66 | $wrapper.unbind(bindSufix);
|
67 | 67 | $original.unbind(keyBind + ' focusin');
|
68 |
| - $outerWrapper.removeClass().addClass([classWrapper, $original.prop('class'), classDisabled].join(' ')); |
| 68 | + $outerWrapper.removeClass().addClass(classWrapper + ' ' + $original.prop('class') + ' ' + classDisabled); |
69 | 69 |
|
70 | 70 | if (!$original.prop('disabled')){
|
71 | 71 | // Not disabled, so... Removing disabled class
|
72 | 72 | $outerWrapper.removeClass(classDisabled);
|
73 | 73 |
|
74 | 74 | // Click on label and :focus on original select will open the options box
|
75 |
| - $wrapper.bind(clickBind, function(e){ isOpen ? _close(e) : _open(e) }); |
76 |
| - $original.bind(keyBind, _keyActions).bind('focusin' + bindSufix, function(e){ isOpen || _open(e) }); |
| 75 | + $wrapper.bind(clickBind, isOpen ? _close : _open); |
| 76 | + $original.bind(keyBind, _keyActions).bind('focusin' + bindSufix, isOpen || _open); |
77 | 77 |
|
78 |
| - $ul = $items.find('ul'); |
| 78 | + // Remove styles from items box |
| 79 | + // Fix incorrect height when refreshed is triggered with fewer options |
| 80 | + $ul = $items.removeAttr('style').find('ul'); |
79 | 81 | $li = $ul.find('li').click(function(e) {
|
80 | 82 | e.stopPropagation();
|
81 | 83 | // The second parameter is to close the box after click
|
|
267 | 269 |
|
268 | 270 | function _calculateHeight() {
|
269 | 271 | var visibleParent = $items.closest(':visible').children(),
|
270 |
| - tempClass = pluginName + 'TempShow'; |
| 272 | + tempClass = pluginName + 'TempShow', |
| 273 | + maxHeight = options.maxHeight; |
271 | 274 |
|
272 | 275 | // Set a temporary class on the hidden parent of the element
|
273 | 276 | visibleParent.addClass(tempClass);
|
274 | 277 |
|
275 | 278 | // Set the dimensions
|
276 |
| - $items.height() > options.maxHeight && $items.height(options.maxHeight); |
| 279 | + $items.height() > maxHeight && $items.height(maxHeight); |
277 | 280 | $items.width($wrapper.outerWidth() - (options.border * 2));
|
278 | 281 |
|
279 | 282 | // Remove the temporary class
|
|
0 commit comments