Tank & Seitendeckel

document.addEventListener('DOMContentLoaded', function() { document.getElementById('newsletterButton').addEventListener('click', function() { var footerElement = document.querySelector('.footer'); var topBarHeight = document.querySelector('.top-bar')?.offsetHeight || 0; var navbarHeight = document.querySelector('.navbar')?.offsetHeight || 0; var shippingInfoHeight = document.querySelector('#shippinginfo')?.offsetHeight || 0; var totalOffset = topBarHeight + navbarHeight + shippingInfoHeight; if (footerElement) { var footerPosition = footerElement.getBoundingClientRect().top + window.pageYOffset - totalOffset; window.scrollTo({ top: footerPosition, behavior: 'smooth' }); } }); }); document.addEventListener('DOMContentLoaded', function() { // Function to hide or show the newsletter button based on the basket price function toggleNewsletterVisibility() { var basketPriceElement = document.querySelector('.toggle-basket-preview .badge'); var newsletter = document.getElementById('newsletterWrapper'); if (basketPriceElement) { var basketPriceText = basketPriceElement.innerText.trim(); if (basketPriceText.startsWith("0,00")) { newsletter.style.display = 'block'; } else { newsletter.style.display = 'none'; } } } // Initially set the visibility based on the current price toggleNewsletterVisibility(); // Observe changes in the basket price element var basketPriceElement = document.querySelector('.toggle-basket-preview .badge'); if (basketPriceElement) { var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.type === 'childList' || mutation.type === 'characterData') { toggleNewsletterVisibility(); } }); }); // Start observing the basket price element for changes observer.observe(basketPriceElement, { childList: true, // Monitor changes to the direct children characterData: true, // Monitor changes to the character data subtree: true // Monitor changes within the subtree }); } });
document.addEventListener('DOMContentLoaded', function() { const menuToggleCheckbox = document.getElementById('menuToggleCheckbox'); const openedMenu = document.getElementById('openedMenu'); menuToggleCheckbox.addEventListener('change', function() { if (this.checked) { openedMenu.style.display = 'block'; } else { openedMenu.style.display = 'none'; } }); }); document.addEventListener('DOMContentLoaded', function() { const menuToggleCheckbox = document.getElementById('menuToggleCheckbox'); menuToggleCheckbox.checked = false; // Ensure checkbox is unchecked on page load });