Animated Counting Numbers In jQuery - numScroll.js

File Size: 6.56 KB
Views Total: 10728
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Animated Counting Numbers In jQuery - numScroll.js

numScroll.js is a jQuery plugin to create an animated counter that animates counting from zero to the desired number on the screen.

How to use it:

1. Include the JavaScript numScroll.js after loading jQuery JavaScript library.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous">
</script>
<script src="js/jquery.numscroll.js"></script>

2. Create an inline element to hold the counter.

<span class="num">
  0
</span>

3. Initialize the counter and specify the target number.

$(function(){

  $(".num").numScroll({
    number: 123456
  });

});

4. Set the delay & duration as per your needs.

$(".num").numScroll({
  'time': 1500,
  'delay': 0
});

5. Decide whether to display decimal and thousands separators. Default: false.

$(".num").numScroll({
  'symbol': true
});

6. Set the step size. Default: 1.

$(".num").numScroll({
  'symbol': true
});

7. Define the the initial value from which the counter will count up. Default: 0.

$(".num").numScroll({
  'fromZero': true
});

Changelog:

2023-05-30

  • Bugfix

2019-08-12

  • v3.0.0: Refactor

2019-08-08

  • v2.0.0: Added options

This awesome jQuery plugin is developed by chaorenzeng. For more Advanced Usages, please check the demo page or visit the official website.