2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-22 12:55:12 +00:00

Merge branch 'master' of github.com:devbridge/jQuery-Autocomplete

This commit is contained in:
Tomas Kirda 2014-10-06 15:48:48 -05:00
commit e6e409f4a4

View File

@ -281,9 +281,7 @@
topOverflow = -scrollTop + offset.top - containerHeight, topOverflow = -scrollTop + offset.top - containerHeight,
bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight); bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom';
? 'top'
: 'bottom';
} }
if (orientation === 'top') { if (orientation === 'top') {
@ -388,7 +386,7 @@
that.selectHint(); that.selectHint();
return; return;
} }
// Fall through to RETURN /* falls through */
case keys.RETURN: case keys.RETURN:
if (that.selectedIndex === -1) { if (that.selectedIndex === -1) {
that.hide(); that.hide();
@ -616,7 +614,11 @@
suggest: function () { suggest: function () {
if (this.suggestions.length === 0) { if (this.suggestions.length === 0) {
this.options.showNoSuggestionNotice ? this.noSuggestions() : this.hide(); if (this.options.showNoSuggestionNotice) {
this.noSuggestions();
} else {
this.hide();
}
return; return;
} }
@ -860,16 +862,17 @@
adjustScroll: function (index) { adjustScroll: function (index) {
var that = this, var that = this,
activeItem = that.activate(index), activeItem = that.activate(index);
offsetTop,
upperBound,
lowerBound,
heightDelta = 25;
if (!activeItem) { if (!activeItem) {
return; return;
} }
var offsetTop,
upperBound,
lowerBound,
heightDelta = $(activeItem).outerHeight();
offsetTop = activeItem.offsetTop; offsetTop = activeItem.offsetTop;
upperBound = $(that.suggestionsContainer).scrollTop(); upperBound = $(that.suggestionsContainer).scrollTop();
lowerBound = upperBound + that.options.maxHeight - heightDelta; lowerBound = upperBound + that.options.maxHeight - heightDelta;