|
1 | 1 | /*
|
2 |
| - * jQuery Form Styler v1.5.3.1 |
| 2 | + * jQuery Form Styler v1.5.3.2 |
3 | 3 | * https://github.com/Dimox/jQueryFormStyler
|
4 | 4 | *
|
5 | 5 | * Copyright 2012-2014 Dimox (http://dimox.name/)
|
6 | 6 | * Released under the MIT license.
|
7 | 7 | *
|
8 |
| - * Date: 2014.06.02 |
| 8 | + * Date: 2014.06.07 |
9 | 9 | *
|
10 | 10 | */
|
11 | 11 |
|
|
527 | 527 | if (search.length) {
|
528 | 528 | search.val('').keyup();
|
529 | 529 | notFound.hide();
|
530 |
| - search.focus().keyup(function() { |
| 530 | + search.keyup(function() { |
531 | 531 | var query = $(this).val();
|
532 | 532 | li.each(function() {
|
533 | 533 | if (!$(this).html().match(new RegExp('.*?' + query + '.*?', 'i'))) {
|
|
608 | 608 | })
|
609 | 609 | // изменение селекта с клавиатуры
|
610 | 610 | .on('keydown.styler keyup.styler', function(e) {
|
| 611 | + var liHeight = li.data('li-height'); |
611 | 612 | divText.html(option.filter(':selected').text());
|
612 | 613 | li.removeClass('selected sel').not('.optgroup').eq(el[0].selectedIndex).addClass('selected sel');
|
613 |
| - // вверх, влево, PageUp |
614 |
| - if (e.which == 38 || e.which == 37 || e.which == 33) { |
615 |
| - dropdown.scrollTop(dropdown.scrollTop() + li.filter('.selected').position().top); |
| 614 | + // вверх, влево, Page Up, Home |
| 615 | + if (e.which == 38 || e.which == 37 || e.which == 33 || e.which == 36) { |
| 616 | + ul.scrollTop(ul.scrollTop() + li.filter('.selected').position().top); |
616 | 617 | }
|
617 |
| - // вниз, вправо, PageDown |
618 |
| - if (e.which == 40 || e.which == 39 || e.which == 34) { |
619 |
| - dropdown.scrollTop(dropdown.scrollTop() + li.filter('.selected').position().top - dropdown.innerHeight() + liHeight); |
| 618 | + // вниз, вправо, Page Down, End |
| 619 | + if (e.which == 40 || e.which == 39 || e.which == 34 || e.which == 35) { |
| 620 | + ul.scrollTop(ul.scrollTop() + li.filter('.selected').position().top - ul.innerHeight() + liHeight); |
620 | 621 | }
|
621 | 622 | // открываем выпадающий список при нажатии Space
|
622 | 623 | if (e.which == 32) {
|
|
0 commit comments