I found this answer with a simple JavaScript counter. How can I change the color of the counter, for e.g.:
- When it is above 10 seconds, its becomes red
- When it is above 20 seconds, it becomes orange.
- When it is above 30 seconds, it becomes blue.
I found this answer with a simple JavaScript counter. How can I change the color of the counter, for e.g.:
you could do something like this.
if( timerCount > 10 && timerCount < 20 )
timerDiv.style.color = 'Your color';
else if( timerCount > 20 && timerCount < 30 )
timerDiv.style.color = 'Your color';
else
timerDiv.style.color = 'Your color';
// timerCount is the variable being incremented
// timerDiv is the variable that is going to be the div
being incremented.
Edit suggested by @user3980820