jquery plugin counter with number formatting
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
NOTICE initial code commit Dec 5, 2012
README.md initial code commit Dec 5, 2012
index.html update Dec 5, 2012
jcount.js initial code commit Dec 5, 2012

README.md

jCount

jquery plugin counter with number formatting

NOTICE:

The jCount plugin was originally created and generously shared by Matt Huggins.

Matt is awesome.

I have added a function to Matt's plugin that formats the numbers (adds commas). Some people think that's awesome too.

For the whole story, read this blog post: http://johnmclaughlin.info/introducing-jcount-a-jquery-countup-plugin-with-output-number-formatting/

Requirements:

jCount requires the latest version of jQuery.

Usage:

The most basic usage of this plugin is to create a DOM element, and apply the countTo method to it in your JS.

<script type="text/javascript"><!--
    $('.timer').countTo({from: 0, to: 500});
//--></script>

<span class="timer"></span>

A more detailed example that demonstrates all possible options being used is as follows.

<script type="text/javascript"><!--
    $('.timer').countTo({
        from: 50,
        to: 2500,
        speed: 1000,
        refreshInterval: 50,
        onComplete: function(value) {
            console.debug(this);
        }
    });
//--></script>

<span class="timer"></span>

Options:

A complete listing of the options that can be passed to the countTo method is below.

Option Description
from The number to start counting from.
to The number to stop counting at.
speed The number of milliseconds it should take to finish counting.
refreshInterval The number of milliseconds updating the count.
onComplete A callback function the is triggered when counting finishes. The final value is passed to the function, and it is run in the context of the DOM element

Created By:

Matt Huggins

License:

jCount and jQuery-countTo are released under the MIT license.