mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-29 16:24:05 +00:00
Added an option to open the container on top
This commit is contained in:
parent
702bc0e9c3
commit
6830fc29ee
@ -1,11 +1,12 @@
|
||||
/**
|
||||
* Ajax Autocomplete for jQuery, version 1.2.9
|
||||
* (c) 2013 Tomas Kirda
|
||||
*
|
||||
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
|
||||
* For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
|
||||
*
|
||||
*/
|
||||
* Ajax Autocomplete for jQuery, version 1.2.9
|
||||
* (c) 2013 Tomas Kirda
|
||||
*
|
||||
*
|
||||
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
|
||||
* For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
|
||||
*
|
||||
*/
|
||||
|
||||
/*jslint browser: true, white: true, plusplus: true */
|
||||
/*global define, window, document, jQuery */
|
||||
@ -77,6 +78,7 @@
|
||||
currentRequest: null,
|
||||
triggerSelectOnValidInput: true,
|
||||
preventBadQueries: true,
|
||||
openOnTop : false,
|
||||
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
|
||||
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
|
||||
},
|
||||
@ -260,6 +262,10 @@
|
||||
left: offset.left + 'px'
|
||||
};
|
||||
|
||||
if(!!that.options.openOnTop){
|
||||
styles.top = $(document).height() - offset.top + 'px';
|
||||
}
|
||||
|
||||
if (that.options.width === 'auto') {
|
||||
styles.width = (that.el.outerWidth() - 2) + 'px';
|
||||
}
|
||||
@ -336,7 +342,7 @@
|
||||
that.selectHint();
|
||||
return;
|
||||
}
|
||||
// Fall through to RETURN
|
||||
// Fall through to RETURN
|
||||
case keys.RETURN:
|
||||
if (that.selectedIndex === -1) {
|
||||
that.hide();
|
||||
@ -506,14 +512,14 @@
|
||||
type: options.type,
|
||||
dataType: options.dataType
|
||||
}).done(function (data) {
|
||||
var result;
|
||||
that.currentRequest = null;
|
||||
result = options.transformResult(data);
|
||||
that.processResponse(result, q, cacheKey);
|
||||
options.onSearchComplete.call(that.element, q, result.suggestions);
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
|
||||
});
|
||||
var result;
|
||||
that.currentRequest = null;
|
||||
result = options.transformResult(data);
|
||||
that.processResponse(result, q, cacheKey);
|
||||
options.onSearchComplete.call(that.element, q, result.suggestions);
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user