Fix nav height not being updated unless window is resized

This commit is contained in:
Michał Gdula 2023-05-19 14:28:27 +01:00
parent 85986048da
commit e6794d42af
5 changed files with 13 additions and 8 deletions

View file

@ -7,16 +7,21 @@ window.onscroll = () => {
checkSection();
};
window.onload = () => {
scrollFunction()
resizeNav();
scrollFunction();
checkSection();
};
window.onresize = () => {
resizeNav();
checkSection();
}
function resizeNav() {
if (window.innerWidth > 600) {
navSpacing = (3 * 16);
} else {
navSpacing = (6 * 16);
}
checkSection();
}
function scrollFunction() {