0๐
โ
i resolve this:
cronometro = setInterval(function (){
contadorSegundos = sec++;
if(contadorSegundos == 300){
sec = 0;
minutos.innerHTML = 5;
if(sec == 60){
min++;
minutos.innerHTML = min;
}
}
console.log(contadorSegundos);
}, 1000);
0๐
You store seconds in a variable referring to minutes. I suggest renaming it.
If you add a check inside the minute-increment condition where you divide the startMin by 60 you have the trigger you where looking for.
if(sec == 60){
min++;
if (minute == startMin/60) {
// do whatever you want to do after the time has passed
}
sec = 0;
...
}
Source:stackexchange.com