-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
39 lines (33 loc) · 979 Bytes
/
script.js
File metadata and controls
39 lines (33 loc) · 979 Bytes
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
const content = document.getElementById("content");
const links = document.querySelectorAll(".load-page");
async function loadPage(page) {
try {
const response = await fetch(page);
const html = await response.text();
content.innerHTML = html;
content.scrollTop = 0;
} catch (error) {
content.innerHTML = "<p>Error al cargar el contenido</p>";
}
}
// Click en enlaces
links.forEach(link => {
link.addEventListener("click", (e) => {
e.preventDefault();
const page = link.dataset.page;
loadPage(page);
});
});
// Cargar página inicial
loadPage("contenido/todo.html");
// Función para copiar email al portapapeles
function copiarEmail() {
const email = "granadossanchezcristina@gmail.com";
navigator.clipboard.writeText(email)
.then(() => {
alert("Email copiado al portapapeles ✔");
})
.catch(() => {
alert("No se pudo copiar el email");
});
}