Created
September 5, 2011 11:36
-
-
Save Radagaisus/1194760 to your computer and use it in GitHub Desktop.
Animate Numbers jQuery Plugin
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
// usage: $(".something").animateNums(300); | |
(function($) { | |
$.fn.animateNums = function(options) { | |
return this.each(function() { | |
e = $(this); | |
var max = e.text(); | |
e.text("0"); | |
animateNums(); | |
function animateNums() { | |
if (e.text() < max) { | |
e.text(Number(e.text()) + 1); | |
setInterval(animateNums, options.speed); | |
} | |
} | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment