What is this?
This is a simple script that finds the number in a dom element, wraps it in a span and counts from 0 to that number when it enters the screen, starting with a small delay.
How to use it?
Just add the following code to your footer.
<ul>
<li class="countup">Count to 100%</li>
<li class="countup">Count to 200kg</li>
<li class="countup">Count to 13</li>
</ul>
<script src="countup.js"></script>
Features
The counter fires only once per page load, has a default delay of 500ms and a default duration of 1000ms. It starts once the element scrolls into view, which is detected by a intersection observer. The settings (delay and duration) can be set in the top of the countup.js file.
License
This code is licensed WTFPL.