luckaerickson's picture
i want a website for my digital service company called Sonate code, a society works in IA, mobile app and web application
2b3e12f verified
document.addEventListener('DOMContentLoaded', function() {
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Form submission handler
const contactForm = document.querySelector('form');
if (contactForm) {
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
// Here you would typically send the form data to your server
alert('Thank you for your message! We will get back to you soon.');
this.reset();
});
}
// Intersection Observer for animations
const animateOnScroll = function() {
const elements = document.querySelectorAll('.fade-in-on-scroll');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-fadeIn');
observer.unobserve(entry.target);
}
});
}, { threshold: 0.1 });
elements.forEach(element => {
observer.observe(element);
});
};
animateOnScroll();
});