From c4acec088014c229e9b4d3c10ddedd172aa5f006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Thu, 18 Nov 2021 21:17:20 +0100 Subject: [PATCH] auto-complete: even stick box if site was already scrolled before open #155 --- static/js/auto-complete.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/auto-complete.js b/static/js/auto-complete.js index 3c184fba77..b7ddb77b7e 100644 --- a/static/js/auto-complete.js +++ b/static/js/auto-complete.js @@ -78,11 +78,11 @@ var autoComplete = (function(){ parentOffsetLeft = parentElement.getBoundingClientRect().left; parentOffsetTop = parentElement.getBoundingClientRect().top; } else { - pageXOffset = window.pageXOffset; - pageYOffset = window.pageYOffset; + pageXOffset = window.pageXOffset || document.documentElement.scrollLeft; + pageYOffset = window.pageYOffset || document.documentElement.scrollTop; } - that.sc.style.left = Math.round(rect.left + (pageXOffset || document.documentElement.scrollLeft) + o.offsetLeft - parentOffsetLeft) + 'px'; - that.sc.style.top = Math.round(rect.bottom + (pageYOffset || document.documentElement.scrollTop) + o.offsetTop - parentOffsetTop) + 'px'; + that.sc.style.left = Math.round(rect.left + pageXOffset + o.offsetLeft - parentOffsetLeft) + 'px'; + that.sc.style.top = Math.round(rect.bottom + pageYOffset + o.offsetTop - parentOffsetTop) + 'px'; that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth if (!resize) { that.sc.style.display = 'block';