Increment / decrement numeric jQuery -


i found code joss crowcroft's solution, maybe similar question jquery-animate-decimal-number-increment-decrement ts have made example on jsfiddle example

jquery({somevalue: 0}).animate({somevalue: 110}, { duration: 1000, easing:'swing', // can step: function() { // called on every step     // update element's text rounded-up value:     $('#el').text(math.ceil(this.somevalue) + "%"); }}); 

but question different, when change end somevalue 110 big numbers 1000000 or millions. end of animate numbers won't exact end somevalue anymore, might end @ 999876 or etc below 1000000. how can make end animated numbers endvalue?

you can provide done function called when animation ends, orbling suggested:

$({numbervalue: currentnumber}).animate({numbervalue: 1000000}, {     duration: 8000,     easing: 'linear',     step: function () {          $('#dynamic-number').text(math.ceil(this.numbervalue));      },     done: function () {         $('#dynamic-number').text(math.ceil(this.numbervalue));     } }); 

working fiddle: http://jsfiddle.net/wzc4f/


Comments

Popular posts from this blog

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -