JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<div>Test</div>
CSS
div { display:block; height:10000px; }
JavaScript
var scrollTopInterval;
$(window).load(function () {
var i = 0;
scrollTopInterval = setInterval( function () {
console.log( $(window).scrollTop() );
if ($(window).scrollTop() > 0) {
weAreReady(); // do stuff, we are ready to go
clearInterval(t);
}
i++;
// 2 seconds might be way too much (but you said you needed a long delay)
if (i >= 2000) { clearInterval(scrollTopInterval); }
}, 1);
});
function weAreReady() {
alert('we moved down past 0 after refresh');
}
$(window).scroll(function () {
clearInterval(scrollTopInterval);
});