auto-complete: even stick box if site was already scrolled before open #155

This commit is contained in:
Sören Weber 2021-11-18 21:17:20 +01:00
parent b84b4157bc
commit c4acec0880
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589

View file

@ -78,11 +78,11 @@ var autoComplete = (function(){
parentOffsetLeft = parentElement.getBoundingClientRect().left; parentOffsetLeft = parentElement.getBoundingClientRect().left;
parentOffsetTop = parentElement.getBoundingClientRect().top; parentOffsetTop = parentElement.getBoundingClientRect().top;
} else { } else {
pageXOffset = window.pageXOffset; pageXOffset = window.pageXOffset || document.documentElement.scrollLeft;
pageYOffset = window.pageYOffset; 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.left = Math.round(rect.left + pageXOffset + o.offsetLeft - parentOffsetLeft) + 'px';
that.sc.style.top = Math.round(rect.bottom + (pageYOffset || document.documentElement.scrollTop) + o.offsetTop - parentOffsetTop) + '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 that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth
if (!resize) { if (!resize) {
that.sc.style.display = 'block'; that.sc.style.display = 'block';