JsRoundRunner – a useful and smart javascript counter for your web applications

A javascript counter, there are many javascript, jquery opensource counters available on the web, but this one, jsRoundRunner is specific, and is built in native javascript.

It allows you to:
– Count up and down
– Add text to counter view
– Change counter color at a specific time
– Format counter to HHMMSS
– Trigger a function at the end of the counter

Want to know how to use it? It’s simple:

//Instantiate the object
var runner = new jsRoundRunner();

//Set parameters
runner.startsAt                 = 0;
runner.endsAt                   = 15;
runner.allowMinutesAndSeconds   = false;

if (runner.startsAt < runner.endsAt) {
    runner.addToView            = '/' + runner.endsAt + 's'; //Additional text to add to the counter
    runner.baseColor            = '#000'; //Base color of the timer
    runner.changeColorAt        = 10; //Time in seconds from which counter must change color
    runner.changeColorColor     = '#FF0000'; //Color to adapt to counter after color changement 
}

runner.counterTagId             = 'counter'; //Div id where to show the counter
runner.callBack                 = stopTimer; //Function to call when jsRoundRunner stops 
runner.start();

function stopTimer() {
    alert('Hello world!');
}

The complete code is hosted on Github: https://github.com/edouardkombo/jsRoundRunner
 
Demo is available here: https://edouardkombo.github.io/jsRoundRunner/demo
 
To download from Bower:

bower install js-round-runner
Advertisements
JsRoundRunner – a useful and smart javascript counter for your web applications

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s