|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
|
|
gsap.registerPlugin(ScrollTrigger); |
|
|
|
|
|
|
|
|
gsap.utils.toArray('section').forEach(section => { |
|
|
gsap.from(section, { |
|
|
scrollTrigger: { |
|
|
trigger: section, |
|
|
start: "top 80%", |
|
|
toggleActions: "play none none none" |
|
|
}, |
|
|
y: 50, |
|
|
opacity: 0, |
|
|
duration: 1, |
|
|
ease: "power3.out" |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
gsap.utils.toArray('.bg-gray-100').forEach((tag, i) => { |
|
|
gsap.from(tag, { |
|
|
scrollTrigger: { |
|
|
trigger: tag, |
|
|
start: "top 90%", |
|
|
toggleActions: "play none none none" |
|
|
}, |
|
|
scale: 0, |
|
|
opacity: 0, |
|
|
duration: 0.5, |
|
|
delay: i * 0.05, |
|
|
ease: "back.out" |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const contactForm = document.querySelector('form'); |
|
|
if (contactForm) { |
|
|
contactForm.addEventListener('submit', function(e) { |
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
|
const name = document.getElementById('name').value; |
|
|
const email = document.getElementById('email').value; |
|
|
const subject = document.getElementById('subject').value; |
|
|
const message = document.getElementById('message').value; |
|
|
|
|
|
|
|
|
if (!name || !email || !message) { |
|
|
alert('Please fill in all required fields'); |
|
|
return; |
|
|
} |
|
|
|
|
|
|
|
|
console.log('Form submitted:', { name, email, subject, message }); |
|
|
alert('Thank you for your message! I will get back to you soon.'); |
|
|
contactForm.reset(); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
document.querySelectorAll('a[href^="#"]').forEach(anchor => { |
|
|
anchor.addEventListener('click', function (e) { |
|
|
e.preventDefault(); |
|
|
document.querySelector(this.getAttribute('href')).scrollIntoView({ |
|
|
behavior: 'smooth' |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |