1// Main JavaScript file for COVID-19 Data Analysis Website 2 3document.addEventListener('DOMContentLoaded', function() { 4 // Add smooth scrolling for anchor links 5 document.querySelectorAll('a[href^="#"]').forEach(anchor => { 6 anchor.addEventListener('click', function(e) { 7 e.preventDefault(); 8 9 const targetId = this.getAttribute('href'); 10 if (targetId === '#') return; 11 12 const targetElement = document.querySelector(targetId); 13 if (targetElement) { 14 window.scrollTo({ 15 top: targetElement.offsetTop - 70, 16 behavior: 'smooth' 17 }); 18 } 19 }); 20 }); 21 22 // Add active class to navigation links based on scroll position 23 const sections = document.querySelectorAll('section[id]'); 24 const navLinks = document.querySelectorAll('nav a'); 25 26 window.addEventListener('scroll', function() { 27 let current = ''; 28 29 sections.forEach(section => { 30 const sectionTop = section.offsetTop; 31 const sectionHeight = section.clientHeight; 32 33 if (pageYOffset >= sectionTop - 100) { 34 current = section.getAttribute('id'); 35 } 36 }); 37 38 navLinks.forEach(link => { 39 link.classList.remove('active'); 40 if (link.getAttribute('href') === `#${current}`) { 41 link.classList.add('active'); 42 } 43 }); 44 }); 45 46 // Ensure all interactive elements are properly clickable 47 // This is a safeguard in addition to the CSS z-index fixes 48 const interactiveElements = document.querySelectorAll('a, button, input, select, textarea'); 49 interactiveElements.forEach(el => { 50 // Ensure all interactive elements have proper z-index 51 if (getComputedStyle(el).zIndex === 'auto' || parseInt(getComputedStyle(el).zIndex) < 5) { 52 el.style.zIndex = '5'; 53 } 54 55 // Ensure all interactive elements have position context 56 if (getComputedStyle(el).position === 'static') { 57 el.style.position = 'relative'; 58 } 59 }); 60});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.