From abe9fda29311b4660237356b51bdeb589896ed61 Mon Sep 17 00:00:00 2001 From: Cay Date: Fri, 13 Mar 2026 08:18:16 +0000 Subject: [PATCH] =?UTF-8?q?Popup=20immer=20mit=20dem=20ersten=20Tab=20?= =?UTF-8?q?=C3=B6ffnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/map-ui.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/public/js/map-ui.js b/public/js/map-ui.js index 755c478..0914ad4 100644 --- a/public/js/map-ui.js +++ b/public/js/map-ui.js @@ -1,6 +1,22 @@ const popup = document.getElementById("building-popup"); const title = document.getElementById("popup-title"); +function resetTabs() { + document + .querySelectorAll(".tab") + .forEach((t) => t.classList.remove("active")); + document + .querySelectorAll(".tab-content") + .forEach((c) => c.classList.remove("active")); + + // erster Tab aktiv + const firstTab = document.querySelector(".tab"); + const firstContent = document.querySelector(".tab-content"); + + if (firstTab) firstTab.classList.add("active"); + if (firstContent) firstContent.classList.add("active"); +} + document.querySelectorAll(".building").forEach((b) => { b.addEventListener("click", async (e) => { e.preventDefault(); @@ -17,6 +33,7 @@ document.querySelectorAll(".building").forEach((b) => { popup.style.top = "50%"; popup.style.display = "block"; + resetTabs(); // AJAX Gebäudedaten laden const res = await fetch("/api" + url);