13 lines
564 B
JavaScript
13 lines
564 B
JavaScript
const menuItems = document.getElementsByClassName("nav-link");
|
|
for(let i = 0; i< menuItems.length; i++) {
|
|
if(menuItems[i].pathname == window.location.pathname) {
|
|
menuItems[i].classList.add("active")
|
|
}
|
|
}
|
|
const dropdownItems = document.getElementsByClassName("dropdown-item");
|
|
for(let i = 0; i< dropdownItems.length; i++) {
|
|
if(dropdownItems[i].pathname == window.location.pathname) {
|
|
dropdownItems[i].classList.add("active")
|
|
$( "#" + dropdownItems[i].id ).closest( ".dropdown" ).find(".dropdown-toggle").addClass("active")
|
|
}
|
|
} |