Animate Counting To A Specified Number - jQuery Counter

Animate Counting To A Specified Number - jQuery Counter
File Size: 2.95 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A dead simple and ultralight jQuery counter plugin that animates numbers counting up or counting down, with custom speed, separator, and decimals.

How to use it:

1. Create a container to place the counter.

<div class="count"></div>

2. Call the function on the container and specify the from/to/ numbers.

jQuery(function($) {
  $('.count').countTo({
    from: 1.11,
    to: 99.99
  });
});

3. That's it. You can specify the animation speed in milliseconds. Default: 500ms.

jQuery(function($) {
  $('.count').countTo({
    from: 1.11,
    to: 99.99,
    speed: 1000
  });
});

4. Customize the decimal separator. Default: '.'.

jQuery(function($) {
  $('.count').countTo({
    from: 1.11,
    to: 99.99,
    decimals: 2, // default: 0
    separator: ','
  });
});

5. Customize the refresh interval in milliseconds. Default: 100ms.

jQuery(function($) {
  $('.count').countTo({
    from: 1.11,
    to: 99.99,
    refreshInterval: 100
  });
});

6. Callback functions available.

jQuery(function($) {
  $('.count').countTo({
    from: 1.11,
    to: 99.99,
    onUpdate: null,
    onComplete: null
  });
});

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