It also provides a scroll spy option which allows you to trigger the animation when the element is scrolled into view.
Import the CountUp.js library into your web project.
# NPM npm install countup.js # Bower bower install countup.js
<script src="countUp.js"></script>
Create a new countup object and specify the target element and start/end numeric values.
var myDemo = new CountUp("yourElement", 22, 99.99); Start the animation.
myDemo.start();
Pause & resume the animation.
myDemo.pauseResume();
Reset the animation.
myDemo.reset();
Update the numeric value.
var newValue = 1999; myDemo.update(newValue);
Possible options with default values.
var myDemo = new CountUp("yourElement", 22, 99.99,{
// start value
startVal: 0,
// number of decimal places
decimalPlaces: 0,
// duration in seconds
duration: 2,
// smooth easing for large numbers above this if useEasing
smartEasingThreshold: 999,
// amount to be eased for numbers above threshold
smartEasingAmount: 333,
// toggle easing
useEasing : true,
// 1,000,000 vs 1000000
useGrouping : true,
// 1,00,000 vs 100,000
useIndianSeparators: false,
// character to use as a separator
separator : ',',
// character to use as a decimal
decimal : '.',
// optional custom easing closure function, default is Robert Penner's easeOutExpo
easingFn: null,
// optional custom formatting function, default is self.formatNumber below
formattingFn: null,
// optional text before the result
prefix: '',
// optional text after the result
suffix: '',
// optionally pass an array of custom numerals for 0-9
numerals: [],
// enable scroll spy
enableScrollSpy: false,
// delay in ms
scrollSpyDelay: 200,
// run only once
scrollSpyOnce: true,
// callbacks
onCompleteCallback: function(){},
onStartCallback: function(){},
}); v2.8.1 (04/23/2025)
v2.8.0 (08/26/2023)
v2.7.0 (06/29/2023)
v2.6.2 (05/01/2023)
v2.6.1 (05/01/2023)
v2.6.0 (03/13/2023)
v2.5.0 (03/01/2023)
v2.4.2 (01/29/2023)
v2.4.1 (01/25/2023)
v2.3.2 (07/10/2022)
v2.3.1 (06/29/2022)
v2.3.0 (06/28/2022)
v2.2.0 (05/18/2022)
v2.1.0 (03/03/2022)
v2.0.8 (07/28/2020)
v2.0.7 (08/26/2020)
v2.0.6 (08/08/2020)
v2.0.4 (06/20/2019)
v1.9.3 (09/21/2018)
The post Customizable Count Up/Down Animations In Pure JavaScript – CountUp.js appeared first on CSS Script.
If you’re after some new games for your Switch 2, you’re in luck, as Ninja…
A Pokémon fan has been able to fund his own wedding, after rediscovering a trio…
The DJI Mini 4K is an excellent quadcopter drone camera for beginners looking to try…
long-press.js is a small JavaScript library which detects and handles the long press/tap event on…
Tension: We perform listening instead of practicing presence, creating distance while appearing close. Noise: The…
Tension: The command-and-control leadership that built successful companies in 2010 now creates anxious, depleted teams.…
This website uses cookies.