cambios para menu mobile

This commit is contained in:
2026-08-31 16:10:59 -03:00
parent 3663318076
commit 89b7efa428
4 changed files with 41 additions and 42 deletions
+14 -2
View File
@@ -27,13 +27,20 @@ async function loadIncludes() {
const footerElem = document.getElementById('site-footer');
try {
if (headerElem) {
if (headerElem && headerElem.children.length === 0) {
const headerRes = await fetch('/includes/header.html', { cache: 'no-store' });
if (headerRes.ok) {
headerElem.innerHTML = await headerRes.text();
highlightActiveNavLink();
attachHeaderEvents();
} else {
// ← NUEVO: Si el fetch falla (ej: 404), igual inicializar eventos
highlightActiveNavLink();
attachHeaderEvents();
}
} else if (headerElem) {
highlightActiveNavLink();
attachHeaderEvents();
}
if (footerElem) {
@@ -43,7 +50,12 @@ async function loadIncludes() {
}
}
} catch (err) {
console.warn('Nota: Inclusión modular de header/footer cargada con respaldo local.');
console.warn('Header modular no disponible:', err);
// ← NUEVO: Intentar inicializar igual si el header ya tiene contenido estático
if (headerElem && headerElem.children.length > 0) {
highlightActiveNavLink();
attachHeaderEvents();
}
}
}