// Clickableparent - Page/Sub.html
document.querySelectorAll('.submenu .nav [data-bs-toggle="collapse"]').forEach(function(sub) {
sub.addEventListener('click', function(e) {
if ( e.currentTarget.classList.contains('collapsed') ) {
href = e.currentTarget.getAttribute('href');
if(href != '#') {
location.href = href;
}
} else {
e.preventDefault();
}
});
});
// Sticky submenu - Page/Sub.html
var submenuPadding = document.querySelectorAll('.submenu');
submenuPadding.forEach( smp => {
if (fixedNavbar) {
smp.style.top = navbarHeight + 15 +'px';
} else {
smp.style.top = '15px';
}
});
var navItems = document.querySelectorAll('.submenu .nav-item');
navItems.forEach( navItem => {
navItem.addEventListener('click', (item) => {
if ( item.target.getAttribute('aria-expanded') == 'true' ) {
item.target.parentNode.classList.add('bg-primary', 'bg-opacity-10');
item.target.classList.add('bg-primary', 'bg-opacity-10');
} else {
item.target.parentNode.classList.remove('bg-primary', 'bg-opacity-10');
item.target.classList.remove('bg-primary', 'bg-opacity-10');
}
});
});