2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-29 08:14:06 +00:00

added onScroll callback

This commit is contained in:
Raf Philtjens 2014-09-09 17:00:20 +02:00
parent 51fc6a6ca7
commit 7f3eea3263

View File

@ -61,6 +61,7 @@
serviceUrl: null, serviceUrl: null,
lookup: null, lookup: null,
onSelect: null, onSelect: null,
onScroll: null,
width: 'auto', width: 'auto',
minChars: 1, minChars: 1,
maxHeight: 300, maxHeight: 300,
@ -832,7 +833,9 @@
offsetTop, offsetTop,
upperBound, upperBound,
lowerBound, lowerBound,
heightDelta = 25; heightDelta = 25,
onScrollCallback = that.options.onScroll,
suggestion = that.suggestions[index];
if (!activeItem) { if (!activeItem) {
return; return;
@ -848,8 +851,12 @@
$(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta); $(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta);
} }
that.el.val(that.getValue(that.suggestions[index].value)); that.el.val(that.getValue(suggestion.value));
that.signalHint(null); that.signalHint(null);
if ($.isFunction(onScrollCallback)) {
onScrollCallback.call(that.element, suggestion);
}
}, },
onSelect: function (index) { onSelect: function (index) {