JSFiddle - React, Tailwind, and code Playground
HTML
<div style="height: 3000px">Scroll TO BOTTOM!
<div id="test" style="margin-top:1500px;">TEST</div>
</div>
JavaScript
$(window).scroll(function() {
if(isElementVisible($('#test'))) {
//Call From here
$(window).off('scroll');
console.log('Visible now')
}
});
function isElementVisible(elem)
{
var visibleTop = $(window).scrollTop();
var visibleBottom = visibleTop + $(window).height();
return ((elem.offset().top + elem.height()) <= visibleBottom);
}