cambios para menu mobile
This commit is contained in:
+14
-2
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user