Created
August 4, 2014 16:50
-
-
Save abovedave/62e96e03512775fd0458 to your computer and use it in GitHub Desktop.
Count up from a given number (jquery(
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function numberWithCommas(x) { | |
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); | |
} | |
$('.count ul li strong').each(function(){ | |
var start = parseInt($(this).text(), 10); | |
var _self = $(this); | |
setInterval(function(){ | |
var update = start++; | |
_self.text(numberWithCommas(update)); | |
}, Math.floor(Math.random() * 450) + 80); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment