Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize feather icons | |
| feather.replace(); | |
| // Theme toggle functionality | |
| const themeToggle = document.querySelectorAll('.theme-toggle, #mobile-theme-toggle'); | |
| themeToggle.forEach(button => { | |
| button.addEventListener('click', toggleTheme); | |
| }); | |
| // Mobile menu toggle | |
| const mobileMenuButton = document.querySelector('.mobile-menu-button'); | |
| const mobileMenu = document.querySelector('.mobile-menu'); | |
| if (mobileMenuButton && mobileMenu) { | |
| mobileMenuButton.addEventListener('click', () => { | |
| mobileMenu.classList.toggle('show'); | |
| }); | |
| } | |
| // Smooth scrolling for 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, | |
| behavior: 'smooth' | |
| }); | |
| // Close mobile menu if open | |
| if (mobileMenu && mobileMenu.classList.contains('show')) { | |
| mobileMenu.classList.remove('show'); | |
| } | |
| } | |
| }); | |
| }); | |
| // Typewriter effect | |
| const typewriterElement = document.getElementById('typewriter'); | |
| if (typewriterElement) { | |
| const roles = ['Cloud Architect', 'MLOps Engineer', 'AI Researcher', 'Data Scientist', 'DevSecOps Expert', 'RPA Developer']; | |
| let roleIndex = 0; | |
| let charIndex = 0; | |
| let isDeleting = false; | |
| function typeWriter() { | |
| const currentRole = roles[roleIndex]; | |
| if (isDeleting) { | |
| typewriterElement.textContent = currentRole.substring(0, charIndex - 1); | |
| charIndex--; | |
| } else { | |
| typewriterElement.textContent = currentRole.substring(0, charIndex + 1); | |
| charIndex++; | |
| } | |
| if (!isDeleting && charIndex === currentRole.length) { | |
| isDeleting = true; | |
| setTimeout(typeWriter, 2000); | |
| } else if (isDeleting && charIndex === 0) { | |
| isDeleting = false; | |
| roleIndex = (roleIndex + 1) % roles.length; | |
| setTimeout(typeWriter, 500); | |
| } else { | |
| setTimeout(typeWriter, isDeleting ? 50 : 150); | |
| } | |
| } | |
| setTimeout(typeWriter, 1000); | |
| } | |
| // Initialize AOS | |
| if (typeof AOS !== 'undefined') { | |
| AOS.init({ | |
| duration: 800, | |
| easing: 'ease-in-out', | |
| once: true | |
| }); | |
| } | |
| }); | |
| function toggleTheme() { | |
| const html = document.documentElement; | |
| html.classList.toggle('dark'); | |
| localStorage.setItem('theme', html.classList.contains('dark') ? 'dark' : 'light'); | |
| } | |
| // Check for saved theme preference | |
| if (localStorage.getItem('theme') === 'dark' || | |
| (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) { | |
| document.documentElement.classList.add('dark'); | |
| } |