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

View File

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