I've recently been put in charge of making a countdown page for a game launch. Now, I've got a simple countdown javascipt file made from this tutorial, but I'd like to make it a bit more fancy. I'd like to find some way to make the numbers fade out to the next one, just to make it a little less "jerky." Is there an easy way to do this? I've googled around and haven't really found a straightforward way.
Here's the JS:
function updatetimer() {
now = new Date();
launch = Date.parse("August 20, 2013 12:00:00");
diff = launch - now;
days = Math.floor( diff / (1000*60*60*24) );
hours = Math.floor( diff / (1000*60*60) );
mins = Math.floor( diff / (1000*60) );
secs = Math.floor( diff / 1000 );
dd = days;
hh = hours - days * 24;
mm = mins - hours * 60;
ss = secs - mins * 60;
document.getElementById("timer")
.innerHTML =
dd + ' days ' +
hh + ' hours ' +
mm + ' minutes ' +
ss + ' seconds';
}
setInterval('updatetimer()', 1000 );
And on the page there's simply an empty div named "timer".