// script.js
document.addEventListener('DOMContentLoaded', function() {
// Mobile menu toggle
const menuBtn = document.querySelector('.menu-btn');
const navLinks = document.querySelector('.nav-links');
menuBtn.addEventListener('click', () => {
navLinks.classList.toggle('active');
});
// Smooth scroll for navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
navLinks.classList.remove('active');
});
});
// Form submission
const form = document.querySelector('.contact-form');
form.addEventListener('submit', function(e) {
e.preventDefault();
// Add your form submission logic here
alert('Thank you for your message! I will get back to you soon.');
form.reset();
});
// Scroll animation
const observerOptions = {
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = 1;
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
document.querySelectorAll('.about, .projects, .contact').forEach(section => {
section.style.opacity = 0;
section.style.transform = 'translateY(20px)';
section.style.transition = 'all 0.5s ease-out';
observer.observe(section);
});
});


0 Comments