I just discovered Odometer which is a cool open source library to transition numbers. It comes with a set of css themes.
Example
Install
Go to the library’s page and download a zip file with the library or fire up bower:
$ bower install odometer |
Include the js library, for example odometer.min.js
.
Include the css for the theme of your choice, for example odometer-theme-car.css
.
Initialisation
Create an element with the CSS class .odometer
and the library will initialise automatically.
Check out the documentation if you need more configuration options.
Update the value
You can update the value by setting the element’s innerHTML
, innerText
, or by using jQuery’s .text()
or .html()
.