diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index f2114bf..5f7db57 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -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); + }); } },