Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', () => { | |
| // Initialize Lucide icons | |
| lucide.createIcons(); | |
| // Intersection Observer for scroll animations | |
| const observerOptions = { | |
| root: null, | |
| rootMargin: '0px', | |
| threshold: 0.1 | |
| }; | |
| const observer = new IntersectionObserver((entries, observer) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.classList.add('visible'); | |
| // Optional: Stop observing once animated | |
| observer.unobserve(entry.target); | |
| } | |
| }); | |
| }, observerOptions); | |
| // Select all elements to animate | |
| document.querySelectorAll('.animate-on-scroll').forEach(el => { | |
| observer.observe(el); | |
| }); | |
| // Navbar scroll effect | |
| const navbar = document.querySelector('.navbar'); | |
| window.addEventListener('scroll', () => { | |
| if (window.scrollY > 50) { | |
| navbar.style.boxShadow = '0 4px 6px -1px rgba(0, 0, 0, 0.1)'; | |
| navbar.style.padding = '0.75rem 0'; | |
| } else { | |
| navbar.style.boxShadow = 'none'; | |
| navbar.style.padding = '1rem 0'; | |
| } | |
| }); | |
| }); | |