JSFiddle - React, Tailwind, and code Playground
HTML
<div id="main">
<div id="footer"></div>
</div>
CSS
#main {
height: 1000px;
position: relative;
}
#footer {
height: 64px;
width: 100%;
position: fixed;
bottom: 0;
background: #000;
display: block;
}
JavaScript
window.addEventListener('scroll', function () {
console.log('scroll: ' + (window.innerHeight + window.scrollY));
console.log('height: ' + document.body.offsetHeight);
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
console.log('here!');
}
});