500); // Mostrar CTA en header después de scroll window.addEventListener('scroll', function() { const headerCta = document.getElementById('header-cta'); if (window.scrollY > 300) { headerCta.style.display = 'inline-flex'; } else { headerCta.style.display = 'none'; } }); // Analytics simulado console.log('📊 Demo CreaMiSitio.es cargada - Mejoras técnicas implementadas:'); console.log('- SEO: Schema.org, Open Graph, meta tags optimizados'); console.log('- Performance: Critical CSS, lazy loading, optimización'); console.log('- Accesibilidad: WCAG AAA, navegación teclado, contrastes'); console.log('- Conversión: CTAs estratégicos, formularios optimizados'); console.log('- Analytics: Event tracking, performance monitoring'); // Track page view (simulado) if (typeof gtag !== 'undefined') { gtag('event', 'page_view', { page_title: 'CreaMiSitio.es - Demo Premium', page_location: window.location.href }); } // Smooth scroll para enlaces internos document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('href'); if (targetId === '#') return; const targetElement = document.querySelector(targetId); if (targetElement) { window.scrollTo({ top: targetElement.offsetTop - 80, behavior: 'smooth' }); // Track CTA clicks (simulado) console.log('🎯 CTA clickeado:', this.textContent.trim()); } }); }); // Formulario de contacto (simulado) const contactForm = document.createElement('div'); contactForm.id = 'contact-form'; contactForm.style.cssText = ` position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 2rem; border-radius: 1rem; box-shadow: 0 20px 60px rgba(0,0,0,0.3); z-index: 2000; display: none; max-width: 500px; width: 90%; `; contactForm.innerHTML = `

Solicitar Consulta

`; document.body.appendChild(contactForm); // Abrir formulario al hacer clic en CTA document.querySelectorAll('a[href="#contact-form"]').forEach(link => { link.addEventListener('click', function(e) { e.preventDefault(); contactForm.style.display = 'block'; document.body.style.overflow = 'hidden'; }); }); // Cerrar formulario document.getElementById('close-form').addEventListener('click', function() { contactForm.style.display = 'none'; document.body.style.overflow = 'auto'; }); // Enviar formulario (simulado) document.getElementById('demo-contact-form').addEventListener('submit', function(e) { e.preventDefault(); // Simular envío setTimeout(function() { document.getElementById('demo-contact-form').style.display = 'none'; document.getElementById('form-success').style.display = 'block'; // Track form submission (simulado) console.log('📝 Formulario enviado - Lead capturado'); // Cerrar después de 3 segundos setTimeout(function() { contactForm.style.display = 'none'; document.body.style.overflow = 'auto'; document.getElementById('demo-contact-form').style.display = 'block'; document.getElementById('form-success').style.display = 'none'; document.getElementById('demo-contact-form').reset(); }, 3000); }, 1000); }); // Cerrar al hacer clic fuera contactForm.addEventListener('click', function(e) { if (e.target === contactForm) { contactForm.style.display = 'none'; document.body.style.overflow = 'auto'; } }); }); // Performance monitoring window.addEventListener('DOMContentLoaded', function() { const perfData = { domReady: performance.timing.domContentLoadedEventEnd - performance.timing.navigationStart, pageLoad: performance.timing.loadEventEnd - performance.timing.navigationStart }; console.log('⚡ Performance metrics:'); console.log('- DOM Ready:', perfData.domReady, 'ms'); console.log('- Page Load:', perfData.pageLoad, 'ms'); // Mostrar badge de performance if (perfData.domReady < 2000) { console.log('✅ Performance: Excelente'); } });