I'm using a script and would like to adjust it - but it does not work. So maybe someone can help me. Script:
window.onscroll = function() {myFunction()};
var navigation = document.getElementById("navigation");
var sticky = navigation.offsetTop;
function myFunction() {
if (window.pageYOffset > sticky) {
navigation.classList.add("sticky");
} else {
navigation.classList.remove("sticky");
}
}
This script add the class sticky to navigation. I would like to add the class "padding-page" to the class "page-content" in this function (also remove it) - as the sticky navigation is not relative anymore and the "page-content" jumps 48px more to top.