How do I modify the following code to detect scrolling to the top page instead.
window.onscroll = function(ev) { if ((window.innerHeight + window.scroll
if (document.body.scrollTop == 0 || document.documentElement.scrollTop == 0) { alert("top"); }
worked for me
https://www.w3schools.com/jsref/event_onscroll.asp