I've created a "60 second" countdown timer in javascript and I'm trying to figure out how to make it not "Jumpy".. The main problem is that the fonts characters are not consistent widths. The only way I see going about this is somehow appending each character into it's own div and controlling the width on that div through css. But I'm not really sure how to go about that. Is there a better approach to this?
I know the Greensock's "TweenMax" plugin can handle this, but I'd like to create this myself as opposed to using a library for one small thing.
jsFiddle:** http://jsfiddle.net/oneeezy/3CreM/1/
HTML:
<div class="row">
<span class="timer timerback">00:00</span>
<span id="Timer" class="timer timerfront">60:00</span>
<span class="seconds">Seconds</span>
</div>
JAVASCRIPT:
var count = 6000;
var counter = setInterval(timer, 10);
function timer()
{
if (count <= 0)
{
clearInterval(counter);
return;
}
count--;
document.getElementById("Timer").innerHTML=count /100;
}