// Help page navigation functionality document.addEventListener('DOMContentLoaded', function() { // Get all navigation links const navLinks = document.querySelectorAll('.help-nav a'); const contentSections = document.querySelectorAll('.content-section'); // Hide all sections except the first one contentSections.forEach((section, index) => { if (index > 0) { section.style.display = 'none'; } }); // Add click event listeners to navigation links navLinks.forEach(link => { link.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('data-target'); const targetSection = document.getElementById(targetId); if (targetSection) { // Hide all sections contentSections.forEach(section => { section.style.display = 'none'; }); // Show the target section targetSection.style.display = 'block'; // Scroll to the section targetSection.scrollIntoView({ behavior: 'smooth' }); // Update active state in navigation updateActiveNav(this); } }); }); // Function to update active navigation state function updateActiveNav(activeLink) { // Remove active class from all links navLinks.forEach(link => { link.classList.remove('active'); }); // Add active class to clicked link activeLink.classList.add('active'); // If it's a sub-link, also activate the parent if (activeLink.parentElement.parentElement.classList.contains('nav-sub')) { const parentLink = activeLink.closest('li').previousElementSibling.querySelector('.nav-main'); if (parentLink) { parentLink.classList.add('active'); } } } // Initialize active state for the first link const firstNavLink = document.querySelector('.help-nav a'); if (firstNavLink) { firstNavLink.classList.add('active'); } });