From 5a7553f9028194b7af766863697de4e90f98ed86 Mon Sep 17 00:00:00 2001 From: ReiMerc Date: Fri, 10 Feb 2023 09:14:36 +0100 Subject: [PATCH] Fix layout when having scrolled down --- frontend/src/Tooltip.ts | 2 +- frontend/src/main.ts | 2 +- frontend/style.css | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/Tooltip.ts b/frontend/src/Tooltip.ts index 4004a29..1156662 100644 --- a/frontend/src/Tooltip.ts +++ b/frontend/src/Tooltip.ts @@ -7,7 +7,7 @@ export class Tooltip { document.body.addEventListener("mousemove", (event: MouseEvent) => { this.element.style.opacity = "1"; this.element.style.left = event.x + OFFSET + "px"; - this.element.style.top = event.y + OFFSET + "px"; + this.element.style.top = event.y + OFFSET + document.documentElement.scrollTop + "px"; if (this.timeout) clearTimeout(this.timeout); this.timeout = setTimeout(() => { diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 51764f4..a3c4b5a 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -114,7 +114,7 @@ function displayZipCode( boundaryElem.style.left = bottomleft.x + rect.left + "px"; boundaryElem.style.top = topright.y + rect.top + document.documentElement.scrollTop + "px"; boundaryElem.style.width = topright.x - bottomleft.x + "px"; - boundaryElem.style.height = bottomleft.y - topright.y + document.documentElement.scrollTop + "px"; + boundaryElem.style.height = bottomleft.y - topright.y + "px"; } function setupMap( diff --git a/frontend/style.css b/frontend/style.css index b1e2775..97324d8 100644 --- a/frontend/style.css +++ b/frontend/style.css @@ -199,7 +199,7 @@ code { #tooltip { display: none; - position: fixed; + position: absolute; background-color: white; color: black; padding: 5px;