Papadoculus/skyvision-pro-drones
0
1document.addEventListener('DOMContentLoaded', function() {2 // Form submission handling3 const contactForm = document.querySelector('form');4 if (contactForm) {5 contactForm.addEventListener('submit', function(e) {6 e.preventDefault();7 8 // Simple form validation9 const name = document.getElementById('name').value;10 const email = document.getElementById('email').value;11 const service = document.getElementById('service').value;12 13 if (!name || !email || !service) {14 alert('Por favor completa todos los campos requeridos');15 return;16 }17 18 // Here you would typically send the form data to a server19 alert('Gracias por tu mensaje. Nos pondremos en contacto contigo pronto.');20 contactForm.reset();21 });22 }23 24 // Smooth scrolling 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 window.scrollTo({35 top: targetElement.offsetTop - 80,36 behavior: 'smooth'37 });38 }39 });40 });41 42 // Add shadow on scroll to navbar43 window.addEventListener('scroll', function() {44 const navbar = document.querySelector('custom-navbar').shadowRoot.querySelector('nav');45 if (window.scrollY > 50) {46 navbar.classList.add('shadow-md', 'bg-opacity-90');47 navbar.classList.remove('bg-opacity-70');48 } else {49 navbar.classList.remove('shadow-md', 'bg-opacity-90');50 navbar.classList.add('bg-opacity-70');51 }52 });53});