jquery-animateNumber - plugin for animating numbers
What can out of the box
- simultaneous animation of a number with other properties (like $ .animate);
- animating numbers from smaller to larger and vice versa;
- number animation with automatic division of digits (you can set your own separator);
- number animation with its own animation step function.
Example
Fun level 0 %.
// функция $.animateNumber принимает такие же аргументы,
// как и $.animate, дополнительно можно использовать
// параметры 'number' и 'numberStep'
$('#fun-level').animateNumber(
{
number: 100,
color: 'green', // требуется jquery.color
'font-size': '50px',
easing: 'easeInQuad', // требуется jquery.easing
numberStep: function(now, tween) {
var floored_number = Math.floor(now),
target = $(tween.elem);
target.text(floored_number + ' %');
}
},
1800
);
Requires jQuery 1.8.0 or later to work.
Demo | Plugin site