forked from scooper/Ruralcleancookingstove
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
750 B
JavaScript
27 lines
750 B
JavaScript
1 year ago
|
|
||
|
|
||
|
window.addEventListener('DOMContentLoaded', event => {
|
||
|
|
||
|
const mainNav = document.body.querySelector('#mainNav');
|
||
|
if (mainNav) {
|
||
|
new bootstrap.ScrollSpy(document.body, {
|
||
|
target: '#mainNav',
|
||
|
rootMargin: '0px 0px -40%',
|
||
|
});
|
||
|
};
|
||
|
|
||
|
|
||
|
const navbarToggler = document.body.querySelector('.navbar-toggler');
|
||
|
const responsiveNavItems = [].slice.call(
|
||
|
document.querySelectorAll('#navbarResponsive .nav-link')
|
||
|
);
|
||
|
responsiveNavItems.map(function (responsiveNavItem) {
|
||
|
responsiveNavItem.addEventListener('click', () => {
|
||
|
if (window.getComputedStyle(navbarToggler).display !== 'none') {
|
||
|
navbarToggler.click();
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
});
|