masks-personality-quiz/interface/static/js/script.js

13 lines
564 B
JavaScript
Raw Permalink Normal View History

2021-11-01 13:58:15 +00:00
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")
}
}