2020-04-07 00:19:58 +02:00
|
|
|
/*!
|
2021-10-18 23:25:29 +02:00
|
|
|
* Start Bootstrap - Agency v7.0.10 (https://startbootstrap.com/theme/agency)
|
2021-03-31 01:03:24 +02:00
|
|
|
* Copyright 2013-2021 Start Bootstrap
|
|
|
|
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-agency/blob/master/LICENSE)
|
|
|
|
*/
|
2021-05-05 02:55:56 +02:00
|
|
|
//
|
|
|
|
// Scripts
|
|
|
|
//
|
2016-06-22 21:35:40 +02:00
|
|
|
|
2021-05-05 02:55:56 +02:00
|
|
|
window.addEventListener('DOMContentLoaded', event => {
|
2014-08-13 03:01:38 +02:00
|
|
|
|
2021-05-06 17:01:08 +02:00
|
|
|
// Navbar shrink function
|
2021-05-05 02:55:56 +02:00
|
|
|
var navbarShrink = function () {
|
|
|
|
const navbarCollapsible = document.body.querySelector('#mainNav');
|
|
|
|
if (!navbarCollapsible) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (window.scrollY === 0) {
|
|
|
|
navbarCollapsible.classList.remove('navbar-shrink')
|
2020-04-10 00:05:24 +02:00
|
|
|
} else {
|
2021-05-05 02:55:56 +02:00
|
|
|
navbarCollapsible.classList.add('navbar-shrink')
|
2020-04-10 00:05:24 +02:00
|
|
|
}
|
2021-05-05 02:55:56 +02:00
|
|
|
|
2020-04-10 00:05:24 +02:00
|
|
|
};
|
2021-05-05 02:55:56 +02:00
|
|
|
|
2021-05-06 17:01:08 +02:00
|
|
|
// Shrink the navbar
|
2021-05-05 02:55:56 +02:00
|
|
|
navbarShrink();
|
|
|
|
|
2021-05-06 17:01:08 +02:00
|
|
|
// Shrink the navbar when page is scrolled
|
2021-05-05 02:55:56 +02:00
|
|
|
document.addEventListener('scroll', navbarShrink);
|
|
|
|
|
2021-05-06 17:01:08 +02:00
|
|
|
// Activate Bootstrap scrollspy on the main nav element
|
2021-05-05 02:55:56 +02:00
|
|
|
const mainNav = document.body.querySelector('#mainNav');
|
|
|
|
if (mainNav) {
|
|
|
|
new bootstrap.ScrollSpy(document.body, {
|
|
|
|
target: '#mainNav',
|
|
|
|
offset: 74,
|
|
|
|
});
|
|
|
|
};
|
2021-03-29 21:59:18 +02:00
|
|
|
|
2021-05-06 17:01:08 +02:00
|
|
|
// Collapse responsive navbar when toggler is visible
|
2021-05-06 03:56:26 +02:00
|
|
|
const navbarToggler = document.body.querySelector('.navbar-toggler');
|
|
|
|
const responsiveNavItems = [].slice.call(
|
|
|
|
document.querySelectorAll('#navbarResponsive .nav-link')
|
|
|
|
);
|
|
|
|
responsiveNavItems.map(function (responsiveNavItem) {
|
|
|
|
responsiveNavItem.addEventListener('click', () => {
|
2021-05-06 15:26:36 +02:00
|
|
|
if (window.getComputedStyle(navbarToggler).display !== 'none') {
|
|
|
|
navbarToggler.click();
|
|
|
|
}
|
2021-05-06 03:56:26 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-05-05 02:55:56 +02:00
|
|
|
});
|