From e72fcb27f0e8aca4c00b9c1ecf2a767b4aed8d4d Mon Sep 17 00:00:00 2001 From: pplayground <37886559+pplayground@users.noreply.github.com> Date: Thu, 29 Mar 2018 03:35:45 +0300 Subject: [PATCH] 'appendTo' property added to options --- jquery.auto-complete.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jquery.auto-complete.js b/jquery.auto-complete.js index 330e04a..91ba68e 100644 --- a/jquery.auto-complete.js +++ b/jquery.auto-complete.js @@ -38,8 +38,8 @@ that.updateSC = function(resize, next){ that.sc.css({ - top: that.offset().top + that.outerHeight(), - left: that.offset().left, + top: that.offset().top - $(o.appendTo).offset().top + that.outerHeight(), + left: that.offset().left - $(o.appendTo).offset().left, width: that.outerWidth() }); if (!resize) { @@ -56,7 +56,7 @@ that.sc.scrollTop(selTop + scrTop); } } - } + }; $(window).on('resize.autocomplete', that.updateSC); that.sc.appendTo('body'); @@ -160,6 +160,7 @@ delay: 150, cache: 1, menuClass: '', + appendTo: 'body', renderItem: function (item, search){ // escape special characters search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');