jquery - JavaScript: how to build simple percentage increaser? -
how build increase value percentage without progress bar.
i have built animator, need simple 1 show value 0%
100%
without progress bar or anything.
here code:
$('.progress-bar').animate( {width:'83%'}, { duration:2000, step: function(now, fx) { if(fx.prop == 'width') { $(this).html(math.round(now * 100) / 100 + '%'); } } } );
progress bar not needed <p></p>
only
i know not way it, javascript knowledge low :(
example fiddle
for updated question
you use interval:
var value = 0, interval = setinterval(function(){ value = ((+value) + .1).tofixed(1); if(value == 80.5) clearinterval(interval); $('p').html(value+'%'); },2);
first post
is looking for?
$('.progress-bar').animate( {width:'100%'}, { duration:2000, step: function(now, fx) { if(fx.prop == 'width') { var newval = math.round(now * 100) / 100 + '%'; $([this,$(this).nextall('p')[0]]).html(newval); } } } );
Comments
Post a Comment