Modificaciones

This commit is contained in:
Ignacio Martinez Navajas
2025-05-05 16:30:11 +02:00
parent 95e10820a3
commit 1ebc22c74b
2 changed files with 38 additions and 4 deletions

View File

@ -424,12 +424,14 @@ $picture = "/assets/img/default-user.png";
tempAnchor.href = href;
const linkPath = tempAnchor.pathname;
// Comparación exacta de ruta
if (browserUrl === linkPath) {
// Corrección: coincide si es igual o si browserUrl empieza con el linkPath + '/'
if (browserUrl === linkPath || browserUrl.startsWith(linkPath + '/')) {
const menuItem = link.closest('.menu-item');
menuItem.classList.add('active');
if (menuItem) {
menuItem.classList.add('active');
}
const parent = menuItem.closest('.menu-sub');
const parent = menuItem?.closest('.menu-sub');
if (parent) {
const parentItem = parent.closest('.menu-item');
if (parentItem) {