I'm trying to animate with "Counter" animation some values that i get from my API by using the following method every time the data from API is changed:
(每当API的数据发生更改时,我都会使用以下方法为“ Counter”动画制作动画,这些动画是通过以下方法从API获取的:)
$('.count').each(function () {
var $this = $(this);
jQuery({ Counter: 0 }).animate({ Counter: $this.text() }, {
duration: 1000,
easing: 'swing',
step: function () {
$this.text(this.Counter.toFixed(2));
}
});
});
The issue is that original value given by API in the following question is 396718.760 so formatted should be 396718.76 but when i'm animating it with the above function it return all times different values as you can see here
(问题是,API在以下问题中给出的原始值为396718.760,因此格式应为396718.76,但是当我使用上述函数对其进行动画处理时,它将返回所有不同的值,如您在此处看到的)
So how can i fix it by returning the right value?
(那么如何通过返回正确的值来解决它?)
ask by Igor Mytyuk translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…