// Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const targetId = this.getAttribute('href'); if (targetId === '#') return; const targetElement = document.querySelector(targetId); if (targetElement) { targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); // Simple scroll animation const animateOnScroll = () => { const elements = document.querySelectorAll('.fade-in, .product-card'); elements.forEach(element => { const elementPosition = element.getBoundingClientRect().top; const screenPosition = window.innerHeight / 1.2; if (elementPosition < screenPosition) { element.style.opacity = '1'; } }); }; // Initialize animations window.addEventListener('load', () => { animateOnScroll(); }); // Add scroll event listener window.addEventListener('scroll', animateOnScroll);