-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
58 lines (46 loc) · 1.73 KB
/
Copy pathscript.js
File metadata and controls
58 lines (46 loc) · 1.73 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
document.addEventListener('DOMContentLoaded', () => {
const menuToggle = document.querySelector('.menu-toggle');
const navLinks = document.querySelector('.nav-links');
menuToggle.addEventListener('click', () => {
navLinks.classList.toggle('active');
});
// Cerrar menú al hacer clic en un enlace
const navItems = document.querySelectorAll('.nav-links a');
navItems.forEach(item => {
item.addEventListener('click', () => {
navLinks.classList.remove('active');
});
});
});
document.addEventListener('DOMContentLoaded', () => {
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('show');
observer.unobserve(entry.target);
}
});
}, {
threshold: 0.1
});
const fadeElements = document.querySelectorAll('.fade-in');
fadeElements.forEach(el => {
observer.observe(el);
});
// Formulario de contacto
const contactForm = document.getElementById('contact-form');
contactForm.addEventListener('submit', (e) => {
e.preventDefault();
const formData = new FormData(contactForm);
const name = formData.get('nombre');
const email = formData.get('email');
const message = formData.get('mensaje');
// Aquí normalmente enviarías los datos a un servidor
console.log('Formulario enviado:', { name, email, message });
// Simulamos una respuesta
setTimeout(() => {
alert('¡Gracias por tu mensaje! Nos pondremos en contacto contigo pronto.');
contactForm.reset();
}, 1000);
});
});