Fixed autocomplete inputs weren't clickable

This commit is contained in:
Marcin Kurczewski 2014-10-11 22:26:27 +02:00
parent 6ca08e5532
commit eb51187ef6
2 changed files with 13 additions and 1 deletions

View file

@ -242,6 +242,7 @@ input[type=checkbox]:checked + label::before {
.autocomplete li { .autocomplete li {
margin: 0; margin: 0;
padding: 0.1em 0.5em !important; padding: 0.1em 0.5em !important;
cursor: pointer;
} }
.autocomplete li.active { .autocomplete li.active {

View file

@ -198,10 +198,21 @@ App.Controls.AutoCompleteInput = function($input) {
} }
$list.empty(); $list.empty();
_.each(results, function(resultItem) { _.each(results, function(resultItem, resultIndex) {
var $listItem = jQuery('<li/>'); var $listItem = jQuery('<li/>');
$listItem.text(resultItem[1]); $listItem.text(resultItem[1]);
$listItem.attr('data-key', resultItem[0]); $listItem.attr('data-key', resultItem[0]);
$listItem.hover(function(e) {
e.preventDefault();
activeResult = resultIndex;
refreshActiveResult();
});
$listItem.mousedown(function(e) {
e.preventDefault();
activeResult = resultIndex;
applyAutocomplete();
hide();
});
$list.append($listItem); $list.append($listItem);
}); });
refreshActiveResult(); refreshActiveResult();