(function($){ $.fn.numberrock=function(options){ var defaults={ speed:24, count:100 }; var opts=$.extend({}, defaults, options); var div_by = 100, count=opts["count"], speed = math.floor(count / div_by), sum=0, $display = this, run_count = 1, int_speed = opts["speed"]; var int = setinterval(function () { if (run_count <= div_by&&speed!=0) { $display.text(sum=speed * run_count); run_count++; } else if (sum < count) { $display.text(++sum); } else { clearinterval(int); } }, int_speed); } })(jquery);