From 19e7fa94f72292442f1cf96b79c55985148fd53a Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Fri, 8 May 2015 18:38:00 +0200 Subject: [PATCH] Fixed autocomplete position near page bottom --- public_html/js/Controls/AutoCompleteInput.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public_html/js/Controls/AutoCompleteInput.js b/public_html/js/Controls/AutoCompleteInput.js index fdae3e9a..a4c751c9 100644 --- a/public_html/js/Controls/AutoCompleteInput.js +++ b/public_html/js/Controls/AutoCompleteInput.js @@ -234,9 +234,15 @@ App.Controls.AutoCompleteInput = function($input) { options.onRender($list); } 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({ - left: ($input.offset().left) + 'px', - top: ($input.offset().top + $input.outerHeight() - 2) + 'px', + left: x + 'px', + top: y + 'px', }); $div.show(); monitorInputHiding();