-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
63 lines (57 loc) · 2.2 KB
/
scripts.js
File metadata and controls
63 lines (57 loc) · 2.2 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
55
56
57
58
59
60
61
62
63
document.addEventListener('DOMContentLoaded', () => {
// Manejo del selector de sesiones
const sessionSelect = document.getElementById('session-select');
const sessionContents = document.querySelectorAll('.session-content');
sessionSelect.addEventListener('change', () => {
const selectedSession = sessionSelect.value;
sessionContents.forEach(content => {
content.style.display = content.id === selectedSession ? 'block' : 'none';
});
});
// Manejo del formulario de contacto
const contactoForm = document.getElementById('contacto-form');
contactoForm.addEventListener('submit', (e) => {
e.preventDefault();
Toastify({
text: "¡Gracias por tu mensaje! Te responderemos pronto.",
duration: 3000,
close: true,
gravity: "top",
position: "right",
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
contactoForm.reset();
});
// Animación de scroll suave
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Animación del logo
const logo = document.querySelector('.logo');
logo.addEventListener('mouseover', () => {
logo.style.transform = 'rotate(360deg)';
logo.style.transition = 'transform 0.5s ease';
});
logo.addEventListener('mouseout', () => {
logo.style.transform = 'rotate(0deg)';
});
});
// Función de redirección con notificación
function redirectAndNotify() {
Toastify({
text: "Redirigiendo...",
duration: 3000,
close: true,
gravity: "top",
position: "right",
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
setTimeout(() => {
window.location.href = "https://www.churchofjesuschrist.org/youth/childrenandyouth/fsy/sessions?country=cl&lang=spa";
}, 3000);
}