Created
July 31, 2019 08:06
-
-
Save mattsandersuk/df384dfd482eb196222f2ba56b152863 to your computer and use it in GitHub Desktop.
countUp Counter Widget - https://inorganik.github.io/countUp.js/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( '.stat-counter' ).each(function() { | |
/** | |
* | |
* Get Vars from Data Attributes | |
* | |
*/ | |
var numFrom = $(this).data('from'); // starting no. | |
var numTo = $(this).data('to'); // end no. | |
var numDec = $(this).data('dec'); // no. of dec places | |
var numSuffix = $(this).data('suffix'); | |
var options = { | |
useEasing : true, | |
useGrouping : true, | |
separator : ',', | |
decimal : '.', | |
prefix : '', | |
suffix : numSuffix | |
}; | |
var counter = new CountUp(this, numFrom, numTo, numDec, 2.5, options); | |
counter.start(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="stat-counter-container"> | |
<span class="stat-counter" data-dec="0" data-from="100" data-to="200">200</span> | |
<span class="stat-desc">Example Description</span> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment