Created
January 24, 2017 20:14
-
-
Save dpmango/a80925326d8431a30c3a78cddd590dc6 to your computer and use it in GitHub Desktop.
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
$.fn.digits = function(){ | |
return this.each(function(){ | |
$(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); | |
}) | |
} | |
$('#animateItem').each(function () { | |
$(this).prop('Counter',0).animate({ | |
Counter: $(this).text() | |
}, { | |
duration: 2000, | |
easing: 'swing', | |
step: function (now) { | |
$(this).text(Math.ceil(now)).digits(); | |
} | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment