Spaces:
Running
Running
| // Mobile menu toggle | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const mobileMenuBtn = document.querySelector('.mobile-menu-btn'); | |
| const navLinks = document.querySelector('.nav-links'); | |
| if (mobileMenuBtn) { | |
| mobileMenuBtn.addEventListener('click', function() { | |
| navLinks.style.display = navLinks.style.display === 'flex' ? 'none' : 'flex'; | |
| }); | |
| } | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Navbar scroll effect | |
| window.addEventListener('scroll', function() { | |
| const nav = document.querySelector('nav'); | |
| if (window.scrollY > 50) { | |
| nav.style.background = 'rgba(255, 255, 255, 0.95)'; | |
| nav.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.1)'; | |
| } else { | |
| nav.style.background = 'white'; | |
| nav.style.boxShadow = 'none'; | |
| } | |
| }); | |
| }); |