如何使动画数量增加

时间:2017-08-21 作者:siberian

现场wordpress显示动态数字在wp编辑器中使用快捷码,如下所示:

[lifetime]
需要使动画数量增加。最大值数字未知,因为数字是动态的。

如何制作this animation 增加wordpress上的数字?

1 个回复
最合适的回答,由SO网友:siberian 整理而成

i make this:

$(window).scroll(function() {
    var currentNumber = $(\'.js-number-lifetime\').text(),
        targetNumber = $(\'.js-number-lifetime\').attr(\'data-target\');
    $({numberValue: currentNumber}).animate({numberValue: targetNumber}, {
        duration: 1000,
        easing: \'linear\',
        step: function() {
            $(\'.js-number-lifetime\').text(Math.ceil(this.numberValue));
        }
    });

    var currentNumber1 = $(\'.js-number-clients\').text(),
        targetNumber1 = $(\'.js-number-clients\').attr(\'data-target\');
    $({numberValue: currentNumber1}).animate({numberValue: targetNumber1}, {
        duration: 1000,
        easing: \'linear\',
        step: function() {
            $(\'.js-number-clients\').text(Math.ceil(this.numberValue));
        }
    });

    var currentNumber2 = $(\'.js-number-employee\').text(),
        targetNumber2 = $(\'.js-number-employee\').attr(\'data-target\');
    $({numberValue: currentNumber2}).animate({numberValue: targetNumber2}, {
        duration: 1000,
        easing: \'linear\',
        step: function() {
            $(\'.js-number-employee\').text(Math.ceil(this.numberValue));
        }
    });
});
结束

相关推荐

WPDB for post count on post

我知道了如何在author上显示自定义帖子类型的计数。php。我也试图在他们的自定义帖子上显示统计数据。同一查询不起作用。如何在自定义帖子上为用户显示自定义帖子的数量?我下面的查询适用于作者。php不是帖子类型本身,我不理解。 <?php global $wp_query; $curauth = $wp_query->get_queried_object(); $post_count = $wpdb->get_