basspistol.com/assets/js/set-20201130.js

32 lines
847 B
JavaScript
Raw Normal View History

2020-07-09 10:15:00 +02:00
// When the user scrolls the page, execute scrollMenu
window.onscroll = function () { scrollMenu() };
// Get the navbar
var navbar = document.getElementById("logo");
2020-09-08 18:07:38 +02:00
var hider = document.getElementById("sticky");
2020-07-09 10:15:00 +02:00
// Get the offset position of the navbar
var sticky = navbar.offsetTop;
// Add the sticky class to the navbar when you reach its scroll position. Remove "sticky" when you leave the scroll position
function scrollMenu() {
if (window.pageYOffset >= sticky) {
2020-09-08 18:07:38 +02:00
hider.classList.add("sticky")
2020-07-09 10:15:00 +02:00
} else {
2020-09-08 18:07:38 +02:00
hider.classList.remove("sticky")
2020-07-09 10:15:00 +02:00
}
}
// Make a pretty background when menu is open
2020-09-08 18:07:38 +02:00
var bodyBluring = document.getElementById("main-wrapper")
2020-07-09 10:15:00 +02:00
function blurBody() {
bodyBluring.classList.toggle("blurredout");
}
function removeBlur() {
bodyBluring.classList.remove("blurredout")
}
/// request permission to autoplay