jQuery animated number counter from zero to value

后端 未结 10 747
天涯浪人
天涯浪人 2020-11-28 04:00

I have created a script to animate a number from zero to it\'s value.

Working

jQuery

10条回答
  •  心在旅途
    2020-11-28 04:31

    This worked for me

    HTML CODE

    841
    

    jQuery Code

    $('.number-count').each(function () {
        $(this).prop('Counter',0).animate({
            Counter: $(this).text()
        }, {
            duration: 4000,
            easing: 'swing',
            step: function (now) {
                $(this).text(Math.ceil(now));
            }
        });
    

提交回复
热议问题