Spaces:
Running
Running
File size: 1,413 Bytes
4abb2ac | 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 | // Form submission handling
document.addEventListener('DOMContentLoaded', function() {
const contactForm = document.querySelector('form');
if (contactForm) {
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
// Get form values
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const message = document.getElementById('message').value;
// Here you would typically send the data to a server
console.log('Form submitted:', { name, email, message });
// Show success message
alert('Tack för ditt meddelande! Vi återkommer så snart vi kan.');
contactForm.reset();
});
}
// Add animations to coffee products on scroll
const observerOptions = {
threshold: 0.1
};
const observer = new IntersectionObserver(function(entries) {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-fadeIn');
}
});
}, observerOptions);
document.querySelectorAll('.bg-white.rounded-lg').forEach(card => {
observer.observe(card);
card.classList.add('opacity-0', 'transition-opacity', 'duration-500');
});
}); |