|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
|
|
const sections = document.querySelectorAll('section'); |
|
|
|
|
|
const observer = new IntersectionObserver((entries) => { |
|
|
entries.forEach(entry => { |
|
|
if (entry.isIntersecting) { |
|
|
entry.target.classList.add('slide-up'); |
|
|
} |
|
|
}); |
|
|
}, { |
|
|
threshold: 0.1, |
|
|
rootMargin: '0px 0px -100px 0px' |
|
|
}); |
|
|
|
|
|
sections.forEach(section => { |
|
|
observer.observe(section); |
|
|
}); |
|
|
|
|
|
|
|
|
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) { |
|
|
window.scrollTo({ |
|
|
top: targetElement.offsetTop - 100, |
|
|
behavior: 'smooth' |
|
|
}); |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const typewriterTexts = [ |
|
|
"Creative Developer", |
|
|
"UI/UX Designer", |
|
|
"Problem Solver", |
|
|
"Tech Enthusiast" |
|
|
]; |
|
|
|
|
|
const typewriterElement = document.querySelector('.typewriter-text'); |
|
|
if (typewriterElement) { |
|
|
let currentTextIndex = 0; |
|
|
let charIndex = 0; |
|
|
let isDeleting = false; |
|
|
let typingSpeed = 100; |
|
|
|
|
|
function typeWriter() { |
|
|
const currentText = typewriterTexts[currentTextIndex]; |
|
|
|
|
|
if (isDeleting) { |
|
|
typewriterElement.textContent = currentText.substring(0, charIndex - 1); |
|
|
charIndex--; |
|
|
typingSpeed = 50; |
|
|
} else { |
|
|
typewriterElement.textContent = currentText.substring(0, charIndex + 1); |
|
|
charIndex++; |
|
|
typingSpeed = 100; |
|
|
} |
|
|
|
|
|
if (!isDeleting && charIndex === currentText.length) { |
|
|
isDeleting = true; |
|
|
typingSpeed = 1500; |
|
|
} else if (isDeleting && charIndex === 0) { |
|
|
isDeleting = false; |
|
|
currentTextIndex = (currentTextIndex + 1) % typewriterTexts.length; |
|
|
typingSpeed = 500; |
|
|
} |
|
|
|
|
|
setTimeout(typeWriter, typingSpeed); |
|
|
} |
|
|
|
|
|
setTimeout(typeWriter, 1000); |
|
|
} |
|
|
|
|
|
|
|
|
const scrollReveal = ScrollReveal({ |
|
|
origin: 'bottom', |
|
|
distance: '60px', |
|
|
duration: 1000, |
|
|
delay: 200, |
|
|
reset: true |
|
|
}); |
|
|
|
|
|
scrollReveal.reveal('.reveal', { |
|
|
interval: 200 |
|
|
}); |
|
|
}); |
|
|
|