Fixed autocomplete position near page bottom

This commit is contained in:
Marcin Kurczewski 2015-05-08 18:38:00 +02:00
parent 06180f5b50
commit 19e7fa94f7

View file

@ -234,9 +234,15 @@ App.Controls.AutoCompleteInput = function($input) {
options.onRender($list); options.onRender($list);
} }
refreshActiveResult(); refreshActiveResult();
var x = $input.offset().left;
var y = $input.offset().top + $input.outerHeight() - 2;
if (y + $div.height() > window.innerHeight) {
y = $input.offset().top - $div.height();
}
$div.css({ $div.css({
left: ($input.offset().left) + 'px', left: x + 'px',
top: ($input.offset().top + $input.outerHeight() - 2) + 'px', top: y + 'px',
}); });
$div.show(); $div.show();
monitorInputHiding(); monitorInputHiding();