0

我有 6 个具有类名“count”的 div。我试图复制这个:http: //jsfiddle.net/4v2wK/

我只是想为数字设置动画,但没有任何效果,这是我的代码:

$('.count').each(function(){
    $({someValue: 1000}).animate({someValue: this.value}, {
        duration: 6000,
        easing: 'swing', // can be anything
        step: function () { // called on every step
            // Update the element's text with rounded-up value:
            $(this).text(commaSeparateNumber(Math.round(this.someValue)));
        }
    });
});

非常感谢您的帮助,

伊莎贝尔,

4

1 回答 1

0

我一直在寻找相同类型的脚本,而这个脚本对我有用:

 $(document).ready(function(){

            $('.feature').each(function(){
                var el = $(this);
                $({someValue: 1}).animate({someValue: el.html()}, {
                    duration: 3000,
                    easing: 'swing',
                    step: function () {                     
                        el.html(Math.round(this.someValue));/**/
                    }
                });
            });

        });

希望能帮助到你 ...

于 2014-06-24T15:28:51.640 回答