JSFiddle - React, Tailwind, and code Playground
HTML
<div id="counter" style="display:none;position:fixed;top:0px;left:0px;">5</div><br>
<div id="d">Hello</div>
CSS
#d{
height:2000px;
width:500px;
}
JavaScript
$(window).scroll(function(){
if ($(window).scrollTop() > 1400) {
var max = 67;
incCounter();
$('#counter').fadeIn(800);
}
function incCounter() {
var currCount = parseInt($('#counter').html());
if (currCount != max) {
$('#counter').html(currCount+1);
setTimeout(incCounter, 20);
}
}
});