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 73
73
// Add active class to current nav item based on URL
74
74
const currentPath = window .location .pathname ;
75
75
const navLinks = document .querySelectorAll (' nav a' );
76
+ const navLabels = document .querySelectorAll (' nav label.nav-link' );
76
77
77
78
navLinks .forEach (link => {
78
79
const linkPath = link .getAttribute (' href' );
82
83
}
83
84
});
84
85
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
+
85
98
// Mobile menu functionality
86
99
const mobileMenuCheckbox = document .getElementById (' mobile-menu-checkbox' );
87
100
const mobileMenu = document .getElementById (' mobile-menu' );
You can’t perform that action at this time.
0 commit comments