Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
54 lines (47 loc) · 1.98 KB
/
Copy pathscript.js
File metadata and controls
54 lines (47 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
document.addEventListener('DOMContentLoaded', () => {
// 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 handling
const form = document.getElementById('medscale-form');
if (form) {
form.addEventListener('submit', function(e) {
e.preventDefault();
const submitBtn = this.querySelector('.btn-submit');
const originalBtnText = submitBtn.innerHTML;
// Simple loading state for the button
submitBtn.innerHTML = '<i data-feather="loader" class="btn-icon rotating"></i> Enviando...';
feather.replace(); // Re-render icon if changed
submitBtn.disabled = true;
submitBtn.style.opacity = '0.7';
// Simulate form submission delay
setTimeout(() => {
alert('¡Gracias por tu interés! Nos pondremos en contacto contigo a la brevedad para agendar tu sesión estratégica.');
// Reset button and form
submitBtn.innerHTML = originalBtnText;
feather.replace(); // Re-render icon
submitBtn.disabled = false;
submitBtn.style.opacity = '1';
form.reset();
}, 2000); // 2 seconds delay
});
}
// Add CSS for rotating loader icon (optional, but good for feedback)
const style = document.createElement('style');
style.innerHTML = `
@keyframes rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.rotating {
animation: rotate 1s linear infinite;
}
`;
document.head.appendChild(style);
});