document.addEventListener('DOMContentLoaded', function() { // Add floating animation to random elements const elements = document.querySelectorAll('.floating-element'); elements.forEach(el => { el.classList.add('floating'); el.style.animationDelay = `${Math.random() * 2}s`; }); // Add pulse animation to interactive elements const interactiveElements = document.querySelectorAll('.pulse-element'); interactiveElements.forEach(el => { el.classList.add('pulsing'); }); // 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 form = document.querySelector('form'); if (form) { form.addEventListener('submit', function(e) { e.preventDefault(); // Here you would typically send the form data to a server alert('Thank you for planting your idea! It will grow in our garden soon.'); form.reset(); }); } });