Skip to content

Commit

Permalink
Added option for setting offset for autocomplete list
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesd authored and Thomas Wanschik committed May 16, 2017
1 parent 59a1293 commit a6dfb9e
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit a6dfb9e

Please sign in to comment.