Answer the question
In order to leave comments, you need to log in
Math.ceil different value each time?
I'm trying to make a smooth enumeration of numbers, everything worked out, but every time I get a different value.
Script
<p id="dynamic-number">0</p>
var test = $('#dynamic-number');
function anim(el, number){
currentNumber = parseFloat(el.text());
$({numberValue: currentNumber}).animate({numberValue: number}, {
duration: 300,
easing: 'linear',
step: function() {
el.text(Math.ceil(this.numberValue));
}
});
}
anim(test, 4444);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question