triggering the odometer with scrolling rather than page load
amhp46 opened this issue · 0 comments
amhp46 commented
How would I get the odometer to trigger when I've scrolled down to display it? Currently, it seems to trigger when the page loads. Thanks
Here is my code:
<script src="https://dentresearch.s3.amazonaws.com/images/odometer_test/odometer.js"></script> <style>.odometer {
font-size: 25px;
}
</style>
1000
<script>setTimeout(function(){
odometer.innerHTML = 4664;
}, 1000);</script>
<script> function n(t){var n=$(t),r=parseInt(n.data("count"));$({countNum:0}).animate({countNum:r},{duration:4e3,easing:"linear",step:function(){n.text(e(Math.floor(this.countNum)))},complete:function(){n.text(e(this.countNum))}})}var r,o=0,i=5,a=$("footer").outerHeight();$(window).scroll(function(t){r=!0}),setInterval(function(){r&&(t(),r=!1)},250),new WOW({callback:function(t){$(t).find(".counter").each(function(){n(this)})}}).init()}),</script>