O
O
OlegSedoy2018-03-16 09:06:28
JavaScript
OlegSedoy, 2018-03-16 09:06:28

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

1 answer(s)
I
imhuman, 2018-03-16
@OlegSedoy

stepDo it insteadprogress

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question