JQuery 1 minute millisecond countdown and callback

I am trying to figure out a way to display a simple countdown that displays 1:00:00, where 1 = minutes, 00 = seconds and 00 = milliseconds.

I found a lot of calls to jQuery on interstitial networks, but none of them contain the ability to display milliseconds initially, and I really do not want to break through thousands of lines of code to try to find a way to crack it there.

Is this something that would be pretty easy to crack?

I also hope that I will have the opportunity to add a callback to the end of the countdown (0:00:00), so that when it ends, I can run another function.

+1
source share
2 answers

It will sound a little off the cuff, but if you make a small animated GIF that goes through ten random sets of two digits ten times per second, your users will never know the difference, and you will not have to worry about what you are going to do with loading your cpu while trying to count milliseconds on a web page.

+8
source
Hi guys, I developed a code to independently use the following code counter for 20 seconds.
var _STOP =0; var value=1999; function settimer() { var svalue = value.toString(); if(svalue.length == 3) svalue = '0'+svalue; else if(svalue.length == 2) svalue = '00'+svalue; else if(svalue.length == 1) svalue = '000'+svalue; else if(value == 0) svalue = '0000'; document.getElementById('cn1').innerHTML = svalue[0]; document.getElementById('cn2').innerHTML = svalue[1]; document.getElementById('cn3').innerHTML = svalue[2]; document.getElementById('cn4').innerHTML = svalue[3]; value--; if (_STOP==0 && value>=0) setTimeout("settimer();", 10); } setTimeout("settimer()", 10); 
+2
source

Source: https://habr.com/ru/post/1380410/


All Articles