countUp.js
countUp.js copied to clipboard
How to use countUP - Jquery with a class selector and values from data attribute?
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?
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 });
});