There is no strict pause and restart for JavaScript timers, only cleanup stops, but can be implemented with some ' cloaking '
Allchild[index].onclick = function () {///Let the timer pause if (Gamint = True) {$ ("#tu" when clicking on the target and satisfying the conditions below)
"). CSS (" Display "," block ");
Timer paused (Clear timer) clearinterval (Countdowntimer); Delay after 2s game continue timer pause End settimeout (function () {//Remove All pictures Removeimgfun (); $ ("#tu"). CSS ("display", "none"); imgnum++; if (
Imgnum >=) {imgnum = ten;} createimgfun ();
The timer continues to pick up the time before the increase continues to play (the previous timer is referred to again including the name of the timer (must have a computer crash) Countdowntimer = setinterval (function () {
Countdownnum-= 0.01;
Retains two decimal countdownnum = countdownnum.tofixed (2); if (countdownnum <= 0) {clearinterval (Countdowntimer);//End of Game alert ("Game Over!")
");
Jaycee name can not be clicked again (score no longer count) Gamint = false;
time.innerhtml = "Countdown:" + Countdownnum + "seconds";},10)},2000)//scoring scores + 1;
score.innerhtml = "The first" + scores + "off";
if (Scores > 8) {$ ("#wc"). CSS ("Display", "block"); $ ("#haha"). CSS ("display", "none"); $ ("#cj"). On ("Click", award ());
$ ("#sm"). On ("Click", Explain ()); }
}
}
The above is a small set of JavaScript to introduce the pause and continue the timer method, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!