Santa Calma Studio Santa Calma Studio
  • Patrones
  • Clases Presenciales
  • Sobre Santa Calma
  • Mi Biblioteca
  • Comenzar
  • const obs = new IntersectionObserver((entries) => { entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('visible'); obs.unobserve(e.target); } }); }, { threshold: 0.12 }); document.querySelectorAll('.reveal').forEach(el => obs.observe(el)); // ── Manejo del formulario ── const form = document.getElementById('contact-form'); const successDiv = document.getElementById('form-success'); // Si la URL tiene ?enviado=1 (redirect de Formspree), mostrar éxito if (new URLSearchParams(window.location.search).get('enviado') === '1') { form.style.display = 'none'; successDiv.classList.add('visible'); } // Envío vía fetch (sin redirección, mejor UX) form.addEventListener('submit', async (e) => { e.preventDefault(); const btn = document.getElementById('btn-submit'); btn.textContent = 'Enviando…'; btn.disabled = true; try { const res = await fetch(form.action, { method: 'POST', body: new FormData(form), headers: { 'Accept': 'application/json' } }); if (res.ok) { form.style.display = 'none'; successDiv.classList.add('visible'); } else { btn.innerHTML = '✕ Hubo un error. Intentá de nuevo.'; btn.disabled = false; } } catch { btn.innerHTML = '✕ Sin conexión. Intentá de nuevo.'; btn.disabled = false; } });