Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', function() { | |
| const menuToggle = document.getElementById('menu-toggle'); | |
| const navLinks = document.querySelector('.nav-links'); | |
| menuToggle.addEventListener('click', function() { | |
| navLinks.classList.toggle('active'); | |
| }); | |
| // Close menu when clicking on a link | |
| document.querySelectorAll('.nav-links a').forEach(link => { | |
| link.addEventListener('click', () => { | |
| navLinks.classList.remove('active'); | |
| }); | |
| }); | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| const target = document.querySelector(this.getAttribute('href')); | |
| if (target) { | |
| window.scrollTo({ | |
| top: target.offsetTop - 70, | |
| behavior: 'smooth' | |
| }); | |
| } | |
| }); | |
| }); | |
| }); |