I want to implement a scroll down menu on my website.
On pages that are taller than the browser window height, I can test the scroll position with window.pageYOffset to decide if the menu should scroll down or not.
However, on pages that are shorter than the browser height, I cannot use the same method, since window.pageYOffset is always 0. Instead, I need to detect the direction of scroll. Can this be done?
Using a combination of:
window.pageYOffsetandwindow.innerHeightYou will be able to calculate how much of your menu is in view and which way to scroll.