diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index 7315ec4..c4864db 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;