SALE

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() { const subcategoriesMenu = document.getElementById('subcategoriesMenu'); function populateSubcategories() { // Find the active category const activeCategory = document.querySelector('.nav-item.active.is-open'); if (!activeCategory) return; // Extract direct subcategories from the active category const subcategories = activeCategory.querySelectorAll(':scope > ul > li > a'); // Clear previous content subcategoriesMenu.innerHTML = ''; // Populate the subcategoriesMenu with new items subcategories.forEach(subcategory => { const div = document.createElement('div'); div.className = 'subcategory-item'; const a = document.createElement('a'); a.href = subcategory.getAttribute('href'); a.textContent = subcategory.querySelector('span').textContent.trim(); a.className = 'subcategory-link'; div.appendChild(a); subcategoriesMenu.appendChild(div); }); } // Call the function to populate subcategories on DOM load populateSubcategories(); // Optional: If categories can be changed dynamically, you may want to call populateSubcategories // on those events as well, ensuring the subcategories are updated accordingly. });