| // Initialize components and add interactivity | |
| document.addEventListener('DOMContentLoaded', () => { | |
| // Smooth scroll for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Add fade-in animation to all custom components | |
| const components = document.querySelectorAll('custom-navbar, custom-card, custom-accordion, custom-testimonials, custom-newsletter, custom-footer'); | |
| components.forEach(component => { | |
| component.classList.add('fade-in'); | |
| }); | |
| }); |