import './style.css'; // Smooth scrolling for navigation links for (const anchor of document.querySelectorAll('a[href^="#"]')) { anchor.addEventListener('click', (e) => { e.preventDefault(); const href = anchor.getAttribute('href'); if (href) { const target = document.querySelector(href); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } } }); } // Mobile menu toggle const hamburger = document.querySelector('.hamburger'); const navMenu = document.querySelector('.nav-menu'); if (hamburger && navMenu) { hamburger.addEventListener('click', () => { navMenu.classList.toggle('active'); }); // Close mobile menu when clicking on a link for (const link of document.querySelectorAll('.nav-menu a')) { link.addEventListener('click', () => { navMenu.classList.remove('active'); }); } } // Contact form handling const contactForm = document.getElementById('contactForm') as HTMLFormElement; if (contactForm) { contactForm.addEventListener('submit', (e) => { e.preventDefault(); const formData = new FormData(contactForm); const data = { name: formData.get('name'), email: formData.get('email'), phone: formData.get('phone'), message: formData.get('message') }; console.log('Form submitted:', data); // Show success message alert('Thank you for your message! We will get back to you soon.'); contactForm.reset(); }); } // Add scroll animation to elements const observerOptions = { threshold: 0.1, rootMargin: '0px 0px -100px 0px' }; const observer = new IntersectionObserver((entries) => { for (const entry of entries) { if (entry.isIntersecting) { entry.target.classList.add('fade-in'); } } }, observerOptions); for (const el of document.querySelectorAll('.product-card, .feature, .contact-item')) { observer.observe(el); }