Display a number progressively on a counter with JavaScript

When we have numbers to display, we often present them blandly and without animation. And yet: creating an animation that progressively displays the final number is very easy to do and will enable you to liven up your numbers! Let's see how in this article.
•
Updated on August 14, 2026
•
2 min read
Believemy logo

When we have numerical data to display, we often present them with a fade effect and without animation. However, creating an animation that progressively displays the final number is very simple to achieve and will make your numbers more engaging! Let's see how to do it in this article.

 

Step 1

Let's start by inserting the libraries into the HTML code.

HTML
 <head>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Counter-Up/1.0.0/jquery.counterup.min.js"></script>
</head>

We will use the libraries jQuery, Waypoints, and Counter-Up to create this animation.

 

Step 2

The HTML code.

HTML
<div class="counter">
    <div class="box">
        <i class="fas fa-user-graduate"></i>
        <div class="num">25,578</div>
        Graduated Students
    </div>
</div>

We will place the number we want to display progressively in the .num class.

Attention: We cannot include spaces; otherwise, the animation will no longer work.

 

Step 3

Style the .counter and .num classes.

CSS
.counter-sec{
  padding: 80px 0;
  width: 100%;
  background: #131416;
  position: absolute;
  top: 50%;
  width: 100%;
  transform: translateY(-50%);
}
.num{
  font-size: 40px;
  margin: 20px 0;
}

 

Step 4

Style the .box class and the icon.

CSS
.box{
  flex: 1;
  text-align: center;
  padding: 20px;
  color: #fff;
  text-transform: uppercase;
}
.box i{
  font-size: 40px;
  color: #333;
}

 

Step 5

Managing the animation in JavaScript.

JAVASCRIPT
  $(document).ready(function(){
    $('.num').counterUp({
      time: 1200
    });
  });

We will use jQuery to wait for the page to load, then we will use Counter-Up to create the animation. time will be the duration the animation takes to display the final number.

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Creating an animated list with CSS

Let's find out how to create an animated hover list!

December 9, 2024

Creating animated presentation cards with JavaScript

Whether you're presenting the team behind your project or anything else, using animated presentation cards will give your page a successful finishing touch. Find out how in this article!

December 9, 2024

Creating a cascading animation on text

For a slogan or for an animation on a very important page of your project, this very modern effect is also very easy to achieve. Let's take a look at how to do it in this article.

December 9, 2024

Create an image slideshow

Let's discover together how to create a simple and effective image slideshow using HTML, CSS and JavaScript!

December 6, 2024

Create an animated gradient background on hover avec CSS

Whether it's to highlight a part of your website or a quote as in this example, generating and adding a gradient to the background can give your website a very modern touch. Find out in this article how to do it easily!

December 9, 2024

Create a live counter of Instagram followers

Here's how to create a live Instagram follower counter that updates automatically every second! Very useful for your websites! We're using the very latest JavaScript feature: fetch!

December 9, 2024

Create a map displaying links on mouse-over with CSS

To present your team or simply yourself, this animation will allow you to display the links to your social networks when you hover over the map: a striking effect guaranteed! Let's find out how to do it together.

December 9, 2024

Create a navigation bar with an animated indicator

Have you always wanted a dynamic navigation bar with an indicator that glides smoothly underneath the new page you're on? This navigation bar is exactly what you need!

December 6, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.