You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
911 B

function initTimer(){
var TimerElem = document.getElementById("progressBar");
TimerElem.style.width = "0%";
document.getElementById("timerend").innerHTML = timeEnd;
}
function move() {
var lapsPerSecond = 100/timeEnd;
var TimerElem = document.getElementById("progressBar");
TimerElem.style.width = (parseInt(TimerElem.style.width) + lapsPerSecond)+"%";
}
var timer = new easytimer.Timer();
timer.start();
timer.addEventListener('secondsUpdated', function (e) {
if(timer.getTimeValues().seconds <= timeEnd){
document.getElementById("timer").innerHTML = timer.getTimeValues().minutes.toString() +" m " + timer.getTimeValues().seconds.toString() + " s";
move();
}else{
endTime();
timer.stop();
}
});
function endTime(){
var modal = document.getElementById("myModal");
modal.style.display = "block";
}