Guest User

Untitled

a guest
Jan 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. // usage: $(".something").animateNums(300);
  2. (function($) {
  3. $.fn.animateNums = function(options) {
  4. return this.each(function() {
  5. e = $(this);
  6. var max = e.text();
  7. e.text("0");
  8. animateNums();
  9.  
  10. function animateNums() {
  11. if (e.text() < max) {
  12. e.text(Number(e.text()) + 1);
  13. setInterval(animateNums, options.speed);
  14. }
  15. }
  16. });
  17. };
  18. })(jQuery);
Add Comment
Please, Sign In to add comment