// MCP Website JavaScript // Highlight active navigation link based on current page document.addEventListener('DOMContentLoaded', () => { const currentLocation = window.location.pathname; const navLinks = document.querySelectorAll('nav a'); navLinks.forEach(link => { if (link.getAttribute('href') === currentLocation || (currentLocation.endsWith('/') && link.getAttribute('href') === '/index.html')) { link.classList.add('nav-active'); } }); }); // Mobile navigation toggle (if needed for responsive design) function toggleMobileNav() { const nav = document.querySelector('nav ul'); nav.classList.toggle('mobile-nav-active'); } // Smooth scroll to anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('href'); const targetElement = document.querySelector(targetId); if (targetElement) { window.scrollTo({ top: targetElement.offsetTop - 80, // Adjust for header height behavior: 'smooth' }); } }); });