works on firefox, chrome, edge. on safari the menu (navbar) appears on scrooling up, but when scrolling to the top of the page, it hides (floats up beyond window) by itself without any scrolling-down action. any ideas why?
in javascript.js:
var prevScrollPos = window.pageYOffset;
let hideNavbar = function() {
var currentScrollPos = window.pageYOffset;
if (prevScrollPos > currentScrollPos) {
document.getElementById("menu").style.top = "0";
} else {
document.getElementById("menu").style.top = "-64px";
}
prevScrollPos = currentScrollPos;
}
window.onscroll = hideNavbar;
in index.html underneath the head:
<body>
<header id="menu">
...
</header>
...
</body>