Back to Home

jquery-animateNumber - plugin for animating numbers

jquery · jquery plugin · animation on jquery

jquery-animateNumber - plugin for animating numbers

    jquery-animateNumber is a jQuery plugin that animates numbers just like on stoloto.ru/rapido .

    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

    Read Next