CoolFace
Apppublic

yunalif/fusion-it-techno-nebula

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
script.js40 linesDownload Raw Back to root
1// Form submission handling2document.addEventListener('DOMContentLoaded', function() {3    const contactForm = document.querySelector('form');4    5    if (contactForm) {6        contactForm.addEventListener('submit', function(e) {7            e.preventDefault();8            9            // Get form values10            const name = document.getElementById('name').value;11            const email = document.getElementById('email').value;12            const subject = document.getElementById('subject').value;13            const message = document.getElementById('message').value;14            15            // Here you would typically send the data to a server16            console.log('Form submitted:', { name, email, subject, message });17            18            // Show success message19            alert('Vielen Dank für Ihre Nachricht! Wir werden uns schnellstmöglich bei Ihnen melden.');20            contactForm.reset();21        });22    }23    24    // Smooth scroll for anchor links25    document.querySelectorAll('a[href^="#"]').forEach(anchor => {26        anchor.addEventListener('click', function (e) {27            e.preventDefault();28            29            const targetId = this.getAttribute('href');30            if (targetId === '#') return;31            32            const targetElement = document.querySelector(targetId);33            if (targetElement) {34                targetElement.scrollIntoView({35                    behavior: 'smooth'36                });37            }38        });39    });40});