I'm working on a page that has multiple stats that I want to countup. I'm using the CountUp jquery plugin here: http://pantrif.github.io/countUp.js/
I've verified in the console that values for each of the elements are there, but for some reason it only counts up the last matched element. I know I'm overlooking something. Any suggestions would be greatly appreciated. Here's the code I have:
$('.countup').each(function() { // each element with .countup class
var countValue = $(this).attr('data-count-up'); //get value from data attribute
console.log(countValue); // verify value is there
var options = {
useEasing : true,
useGrouping : true,
separator : ',',
decimal : '.',
prefix : '',
suffix : ''
};
var stat = $(this).CountUp(0, countValue, 1, 1.5, options); // countup with value
stat.start(); // start the countup
})
<ul class="stats">
<li class="anim-up delay-3">
<div class="stat white">
<span class="stat-number"><span class="countup" data-count-up="318830">318,830</span></span> homes and apartments financed
</div>
</li>
<li class="anim-up delay-4">
<div class="stat white">
<span class="stat-number">$<span class="countup" data-count-up="30.1">30.1 billion</span></span> in real estate value produced
</div>
</li>
</ul>