Spaces:
Running
Running
File size: 2,917 Bytes
6ce71c9 df3288a 6ce71c9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
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');
} |