sol-vote/templates/assets/js/startup-modern.js
Nathan Woodburn f8c98214bf
All checks were successful
Build Docker / Build Image (push) Successful in 39s
feat: Add initial code
2024-02-19 15:18:49 +11:00

27 lines
712 B
JavaScript

(function() {
"use strict"; // Start of use strict
var mainNav = document.querySelector('#mainNav');
if (mainNav) {
// Collapse Navbar
var collapseNavbar = function() {
var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
if (scrollTop > 100) {
mainNav.classList.add("navbar-shrink");
} else {
mainNav.classList.remove("navbar-shrink");
}
};
// Collapse now if page is not at top
collapseNavbar();
// Collapse the navbar when page is scrolled
document.addEventListener("scroll", collapseNavbar);
}
})(); // End of use strict