countUp.js icon indicating copy to clipboard operation
countUp.js copied to clipboard

How to use countUP - Jquery with a class selector and values from data attribute?

Open krishnaprasadkckp opened this issue 2 years ago • 1 comments

Description

Thanks for the great plugin. I'm trying to use the Jquery version with a general format everywhere on my website, like this -
<span class="counter" data-number="96" data-decimal-count="0"></span> As per documentation, it seems a unique ID with numbers. Can I use like this with this plugin?

krishnaprasadkckp avatar May 20 '22 06:05 krishnaprasadkckp

I'm not a project contributor, but you can try this:

<span class="counter" data-end-val="96" data-decimal-places="0"></span>
$('.counter').each(function() {
  $(this).countup({ ...this.dataset });
});

barkdoll avatar Jul 31 '22 14:07 barkdoll