【发布时间】:2020-05-08 15:38:47
【问题描述】:
我已经构建了一个 Web 应用程序,其中 HTML 代码从 python 接收整数值。我想添加从 0 到该数字动画的计数。 我在 StackOverflow 上检查了很多这样的查询,例如 link。
今天早上动画效果很好,但现在不行了。
$('.count').each(function ()
{
$(this).prop('Counter',0).animate
({
Counter: $(this).text()
},
{
duration: 10000,
easing: 'swing',
step: function (now)
{
$(this).text(Math.ceil(now));
}
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<h4 class="font-weight-bold" style="color:#f92424"><span class="count">{{ confirmedIn }}</span></h4>
也许我错过了一些图书馆之类的东西,idk
谁能帮我解决这个问题?
【问题讨论】:
-
@Denis,我根据版本更新了 jquery 库。但现在垃圾值是动画而不是我输入的值。
标签: javascript jquery