Skip to content

Instantly share code, notes, and snippets.

@timothyclifford
timothyclifford / gist:1102121
Created July 24, 2011 02:19
Javascript number counter animation
// Instantiate global variable to house timeout object
var animationTimeout;
function recalculateDiscount() {
// Get previous discount
var previousDiscount = parseInt(totalDiscount);
// Get current discount
totalDiscount = parseInt(calculateDiscount());
// If previous and current differ, update
if (previousDiscount != totalDiscount) {