Christian Heilmann

Posts Tagged ‘counter’

JavaScript countdown solution

Tuesday, February 5th, 2008

This is not going to be amazing, but I had to find / write a script like that for every hackday / barcamp I attended so far. Being lazy, I just wanted to create one I can re-use later on. So here you are:

You can either use the counter directly, or right-click and save it for local use. The look and feel is all in the CSS, yo u can set some of the preferences in the counter interface and there are several configuration settings you can change:


var cfg = {
displayID:’display’, // element to show the seconds
startButtonID:’c’, // start button ID
pauseButtonID:’p’, // pause button ID
finalClass:’final’, // class to add when final coutdown is reached
overClass:’over’, // class to add when the time is over
initialText:{
value:’2:00’,
label:’Initial Text’
},
seconds:{
value:2*60,
label:’Time in Seconds’
},
finalCountdown:{
value:30,
label:’Time when the warning starts’
},
pauseLabel:{
value:’pause’,
label:’Pause Text’
},
resumeLabel:{
value:’resume’,
label:’Resume Text’
}

};

Some configuration settings have values and labels, this is because of the preferences form being created from this object.

As said, nothing special, but I hope you can use it, I know I will.