Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ The standard jquery.autocomplete.js file is around 13KB when minified.
* `groupBy`: property name of the suggestion `data` object, by which results should be grouped.
* `maxHeight`: Maximum height of the suggestions container in pixels. Default: `300`.
* `width`: Suggestions container width in pixels, e.g.: 300, `flex` for max suggestion size and `auto` takes input field width. Default: `auto`
* `positionOffset`: Offset of suggestions container in pixels. Default: `[0, 0]`.
* `zIndex`: 'z-index' for suggestions container. Default: `9999`.
* `appendTo`: container where suggestions will be appended. Default value `document.body`. Can be jQuery object, selector or HTML element. Make sure to set `position: absolute` or `position: relative` for that element.
* `forceFixPosition`: Default: `false`. Suggestions are automatically positioned when their container is appended to body (look at `appendTo` option), in other cases suggestions are rendered but no positioning is applied.
Expand Down
6 changes: 4 additions & 2 deletions src/jquery.autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@
showNoSuggestionNotice: false,
noSuggestionNotice: 'No results',
orientation: 'bottom',
forceFixPosition: false
forceFixPosition: false,
positionOffset: [0, 0]
};

function _lookupFilter(suggestion, originalQuery, queryLowerCase) {
Expand Down Expand Up @@ -308,7 +309,8 @@
containerHeight = $container.outerHeight(),
height = that.el.outerHeight(),
offset = that.el.offset(),
styles = { 'top': offset.top, 'left': offset.left };
styles = { 'top': offset.top + that.options.positionOffset[1],
'left': offset.left + that.options.positionOffset[0] };

if (orientation === 'auto') {
var viewPortHeight = $(window).height(),
Expand Down