links repariert

V-S-US-01-03-Pakete-Online-buchen
Vincent Laux 2026-09-30 17:48:41 +02:00
parent f2504995c2
commit d4ea167f62
2 changed files with 15 additions and 21 deletions

View File

@ -110,25 +110,19 @@ document.addEventListener("DOMContentLoaded", async () => {
body.appendChild(liste); body.appendChild(liste);
// 6. Button // 6. Button – Link zur Paketseite
const button = document.createElement("button"); const paketLinkMap = {
button.classList.add("paket-karte__cta"); "starter": "html/paket-starter.html",
button.type = "button"; "standard": "html/paket-standard.html",
button.textContent = "Paket wählen"; "premium": "html/paket-premium.html"
button.dataset.paket = paket.dataPaket; };
button.setAttribute("aria-pressed", "false");
button.addEventListener("click", () => { const paketLink = paketLinkMap[paket.dataPaket] || "#";
grid.querySelectorAll(".paket-karte").forEach(andereKarte => { const button = document.createElement("a");
andereKarte.classList.remove("paket-karte--ausgewaehlt"); button.classList.add("paket-karte__cta");
andereKarte.querySelector("button").setAttribute("aria-pressed", "false"); button.href = paketLink;
}); button.textContent = "Paket ansehen";
karte.classList.add("paket-karte--ausgewaehlt"); button.setAttribute("role", "button");
button.setAttribute("aria-pressed", "true");
document.dispatchEvent(new CustomEvent("paket:ausgewaehlt", {
detail: { paket: button.dataset.paket }
}));
});
body.appendChild(button); body.appendChild(button);
karte.appendChild(body); karte.appendChild(body);

View File

@ -17,7 +17,7 @@
], ],
"badge": null, "badge": null,
"empfohlen": false, "empfohlen": false,
"dataPaket": "Starter" "dataPaket": "starter"
}, },
{ {
"name": "STANDARD", "name": "STANDARD",
@ -33,7 +33,7 @@
], ],
"badge": "Beliebteste Wahl", "badge": "Beliebteste Wahl",
"empfohlen": true, "empfohlen": true,
"dataPaket": "STANDARD" "dataPaket": "standard"
}, },
{ {
"name": "PREMIUM", "name": "PREMIUM",
@ -49,7 +49,7 @@
], ],
"badge": null, "badge": null,
"empfohlen": false, "empfohlen": false,
"dataPaket": "PREMIUM" "dataPaket": "premium"
} }
] ]
} }