I am trying to set the duration of my counter to be slow without having a large duration number set in the code for example:
duration: 99999;
Originally I had the counter set to a low number but the count is to reach 1,000,000,00 but i want to be able to control how fast this counts.
Here is how I currently have it set up.
<div class="counter" data-count="1000000">0</div>
and my JS is as follows:
$('.counter').each(function() {
var $this = $(this),
countTo = $this.attr('data-count');
$({ countNum: $this.text()}).animate({
countNum: countTo
},
{
duration: 99999,
easing:'linear',
step: function() {
$this.text(Math.floor(this.countNum));
}
});
});
I am a Junior at this so any other recommendations would be appreciated.
Thanks