I had some help yesterday to achieve this: http://jsfiddle.net/hopkins_matt/513ng07d/ (Thanks to Matt Hopkins) -----
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function timeSince() {
var prevTime = new Date(2015,8,8,0,0);
var thisTime = new Date();
return (thisTime.getTime() - prevTime.getTime()) / 1000;
}
function parcelCount() {
var secDiff = timeSince();
var leftNum = document.getElementById("left");
var midNum = document.getElementById("mid");
var leftNumCount = Math.round(((76/60) * secDiff) + 40093794);
var midNumCount = Math.round(((43/60) * secDiff) + 22874098);
leftNum.innerHTML = numberWithCommas(leftNumCount);
midNum.innerHTML = numberWithCommas(midNumCount);
}
parcelCount();
setInterval(parcelCount, 1000);
I also want to create a spinning total until the final figure is reached...
I.E. We have shipped to 190 countries, is it possible to spin this number from 0-190 when the text is reached on screen?
So it would spin numbers until it reached the 190, then stop.
Any help would be appreciated :)