From 032d40ef47ea7ee637ef92a2b26925d3ae3176b7 Mon Sep 17 00:00:00 2001 From: JoulianALS Date: Thu, 18 Apr 2024 16:54:15 +0200 Subject: [PATCH] Tutti Frutti --- Javascript/app.js | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/Javascript/app.js b/Javascript/app.js index a2857f6..dee247e 100644 --- a/Javascript/app.js +++ b/Javascript/app.js @@ -8,33 +8,23 @@ const swiper = new Swiper('.swiper', { }); // Für die Links in der Navbar, dass die Striche beim aktuell geklickten bleiben -document.addEventListener("DOMContentLoaded", function() { - var navLinks = document.querySelectorAll('.navbar .nav-link'); - var initialSelected = document.querySelector('.navbar .nav-link[aria-current="page"]'); - if (initialSelected) { - initialSelected.classList.add('selected'); - } +var navLinks = document.querySelectorAll('.navbar .nav-link'); +var initialSelected = document.querySelector('.navbar .nav-link[aria-current="page"]'); +if (initialSelected) { + initialSelected.classList.add('selected'); +} - navLinks.forEach(function(link) { - link.addEventListener('click', function() { - // Alle anderen Links zurücksetzen - navLinks.forEach(l => l.classList.remove('selected')); - // Die 'selected' Klasse zum angeklickten Link hinzufügen - link.classList.add('selected'); - }); - }); -}); -// Für Patenshop -document.getElementById('donationForm').addEventListener('submit', function(event) { - event.preventDefault(); - alert('Alles in Ordnung. Vielen Dank für Ihre Spende!'); - this.reset(); +navLinks.forEach(function(link) { + link.addEventListener('click', function() { + // Alle anderen Links zurücksetzen + navLinks.forEach(l => l.classList.remove('selected')); + // Die 'selected' Klasse zum angeklickten Link hinzufügen + link.classList.add('selected'); + }); }); // Für Preis -document.addEventListener('DOMContentLoaded', function() { - updatePrice(); -}); +updatePrice(); function updatePrice() { const fresserchenSelect = document.getElementById('Fresserchen'); @@ -50,4 +40,5 @@ function updatePrice() { function showDonationAmount() { const priceInput = document.getElementById('Preis').value; alert('Danke für deine Spende von €' + priceInput + '!'); + window.location.reload(); }