From 9fbadc14515299fb077712f67d75cddc85d6d566 Mon Sep 17 00:00:00 2001 From: Jens Balvig Date: Thu, 25 Sep 2014 09:16:42 +0200 Subject: [PATCH] Use height of items to compute heightDelta --- src/jquery.autocomplete.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index 7315ec45..c4864db9 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -851,16 +851,17 @@ adjustScroll: function (index) { var that = this, - activeItem = that.activate(index), - offsetTop, - upperBound, - lowerBound, - heightDelta = 25; + activeItem = that.activate(index) if (!activeItem) { return; } + var offsetTop, + upperBound, + lowerBound, + heightDelta = $(activeItem).outerHeight(); + offsetTop = activeItem.offsetTop; upperBound = $(that.suggestionsContainer).scrollTop(); lowerBound = upperBound + that.options.maxHeight - heightDelta;