diff --git a/service2.js b/service2.js index 3c8be87..c197952 100644 --- a/service2.js +++ b/service2.js @@ -308,10 +308,13 @@ class BesService { */ setStatusDivPosition() { const rect = this.hostElement.getBoundingClientRect() - const scrollLeft = window.scrollX || document.documentElement.scrollLeft - const scrollTop = window.scrollY || document.documentElement.scrollTop - this.statusDiv.style.left = `${rect.right - 40 + scrollLeft}px` - this.statusDiv.style.top = `${rect.bottom - 30 + scrollTop}px` + const parentRect = this.hostElement.parentElement.getBoundingClientRect() + const scrollbarWidth = + this.hostElement.offsetWidth - this.hostElement.clientWidth + this.statusDiv.style.left = `${ + rect.right - parentRect.left - 40 - scrollbarWidth + }px` + this.statusDiv.style.top = `${rect.bottom - parentRect.top - 30}px` } /**