File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 7373 // Add active class to current nav item based on URL
7474 const currentPath = window .location .pathname ;
7575 const navLinks = document .querySelectorAll (' nav a' );
76+ const navLabels = document .querySelectorAll (' nav label.nav-link' );
7677
7778 navLinks .forEach (link => {
7879 const linkPath = link .getAttribute (' href' );
8283 }
8384 });
8485
86+ navLabels .forEach (label => {
87+ const parent = label .closest (' li' );
88+ const submenuLinks = parent .querySelectorAll (' .dropdown-glass a' );
89+ submenuLinks .forEach (submenuLink => {
90+ const submenuPath = submenuLink .getAttribute (' href' );
91+ if (submenuPath && (submenuPath === currentPath ||
92+ (submenuPath !== ' /' && currentPath .startsWith (submenuPath)))) {
93+ label .classList .add (' active' );
94+ }
95+ });
96+ });
97+
8598 // Mobile menu functionality
8699 const mobileMenuCheckbox = document .getElementById (' mobile-menu-checkbox' );
87100 const mobileMenu = document .getElementById (' mobile-menu' );
You can’t perform that action at this time.
0 commit comments