Brimstone
New member
Loving this Scoreboard Assistant so far!! Very versatile application! And not to terribly hard to figure out, even for me with zero coding experience.
I am having a slight issue though with a countdown timer I have created. I followed the YouTube tutorial exactly and get a strange problem.
When I start the timer the webpage displays the timer running. When I pause the timer, the webpage doesn't pause. The timer continues to run. When I restart the timer again, the webpage appears to be running both timers at the same time, one from where it left off when paused and the other the one that didn't pause.
Using Chrome. I triple checked that I used the exact code from your YouTube tutorial and just can't find why this is not working right...
Any help would be much appreciated!
Page Javascript:
Lee J
I am having a slight issue though with a countdown timer I have created. I followed the YouTube tutorial exactly and get a strange problem.
When I start the timer the webpage displays the timer running. When I pause the timer, the webpage doesn't pause. The timer continues to run. When I restart the timer again, the webpage appears to be running both timers at the same time, one from where it left off when paused and the other the one that didn't pause.
Using Chrome. I triple checked that I used the exact code from your YouTube tutorial and just can't find why this is not working right...
Any help would be much appreciated!
Page Javascript:
Code:
clearInterval(timeclock);
$('.timeclock').text(calcTimer(docData['Timeclock_o']));
if (docData['Timeclock_s'] > 0)
{
countdown = setInterval(function()
{
time = parseInt(docData['Timeclock_e']) + parseInt(docData['Timeclock_o']) - new Date().getTime();
$('.timeclock').text(calcTimer(time));
}, 100);
}
function calcTimer(time)
{
let neg = (time < 0) ? '- ' : '';
time = Math.abs(time / 1000);
hours = (Math.floor(time / 3600));
minutes = (Math.floor(time % 3600 / 60)).toString().padStart(2, '0');
seconds = (time % 60).toFixed().toString().padStart(2, '0');
return neg + minutes + ' : ' + seconds;
}
Lee J