JavaScript animated number count up

To do the jquery javascript animated number count up feature on your website you need jquery on your page:

<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

Include the following javascript in a .js file:

$('.counter').each(function () {
    $(this).prop('Counter',0).animate({
        Counter: $(this).text()
    }, {
        duration: 7000,
        easing: 'linear',
        step: function (now) {
            $(this).text(Math.ceil(now));
        }
    });
});

Change the duration to make the count up quicker or slower and use this HTML code on your page:

<h3>Goals scored: <div class="counter" data-count="41">0</div></h3>

41 is the number it counts up to.