// Main JavaScript file document.addEventListener('DOMContentLoaded', function() { // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const targetId = this.getAttribute('href'); if (targetId === '#') return; const targetElement = document.querySelector(targetId); if (targetElement) { targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); // Form submission handling const contactForm = document.querySelector('form'); if (contactForm) { contactForm.addEventListener('submit', function(e) { e.preventDefault(); // In a real implementation, you would send the form data to a server alert('Thank you for your message! I will get back to you soon.'); this.reset(); }); } // Initialize tooltips for certifications tippy('[data-tippy-content]', { theme: 'light-border', animation: 'scale', arrow: true, duration: 200, }); // Add animation classes when elements come into view const animateOnScroll = () => { const elements = document.querySelectorAll('.animate-on-scroll'); elements.forEach(element => { const elementPosition = element.getBoundingClientRect().top; const screenPosition = window.innerHeight / 1.3; if (elementPosition < screenPosition) { element.classList.add('animate-fade-in'); } }); }; window.addEventListener('scroll', animateOnScroll); animateOnScroll(); // Run once on page load });