I have this element on my site, it's working fine but only set to a time delay and I'd like the counter to start when the element is in view, so when a customer scrolls to this element
Can anyone help update the code so the numbers start when the element is visible on the screen? I ideally need a copy and paste of new code as I am not a developer.
HTML
<div id="odometer" class="odometer">1</div>
<div id="odometer2" class="odometer">1</div>
<div id="odometer3" class="odometer">1</div>
JS
<script src="https://github.hubspot.com/odometer/odometer.js"></script>
<script>
setTimeout(function() {
odometer.innerHTML = 351;
}, 3000);
setTimeout(function() {
odometer2.innerHTML = 3684;
}, 4500);
setTimeout(function() {
odometer3.innerHTML = 110520;
}, 5500);
</script>