Skip to content

Commit e6e409f

Browse files
author
Tomas Kirda
committed
Merge branch 'master' of github.com:devbridge/jQuery-Autocomplete
2 parents 062e9bd + 2d7e98f commit e6e409f

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/jquery.autocomplete.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,7 @@
281281
topOverflow = -scrollTop + offset.top - containerHeight,
282282
bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
283283

284-
orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow)
285-
? 'top'
286-
: 'bottom';
284+
orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom';
287285
}
288286

289287
if (orientation === 'top') {
@@ -388,7 +386,7 @@
388386
that.selectHint();
389387
return;
390388
}
391-
// Fall through to RETURN
389+
/* falls through */
392390
case keys.RETURN:
393391
if (that.selectedIndex === -1) {
394392
that.hide();
@@ -616,7 +614,11 @@
616614

617615
suggest: function () {
618616
if (this.suggestions.length === 0) {
619-
this.options.showNoSuggestionNotice ? this.noSuggestions() : this.hide();
617+
if (this.options.showNoSuggestionNotice) {
618+
this.noSuggestions();
619+
} else {
620+
this.hide();
621+
}
620622
return;
621623
}
622624

@@ -860,16 +862,17 @@
860862

861863
adjustScroll: function (index) {
862864
var that = this,
863-
activeItem = that.activate(index),
864-
offsetTop,
865-
upperBound,
866-
lowerBound,
867-
heightDelta = 25;
865+
activeItem = that.activate(index);
868866

869867
if (!activeItem) {
870868
return;
871869
}
872870

871+
var offsetTop,
872+
upperBound,
873+
lowerBound,
874+
heightDelta = $(activeItem).outerHeight();
875+
873876
offsetTop = activeItem.offsetTop;
874877
upperBound = $(that.suggestionsContainer).scrollTop();
875878
lowerBound = upperBound + that.options.maxHeight - heightDelta;

0 commit comments

Comments
 (0)