I am a novice. I have been working on a post list countdown function recently. I suffer from my lack of talent and lack of skills, so the countdown has not been able to work well. I forgot to give you some advice!
Get back to the topic
I want to get the time when the post was published to start the countdown, countdown End Close Show Post!
Because it is multi-tasking, only one of the referenced countdown codes can take effect, or the countdown can be refreshed and the countdown starts again, which is very distressing! I hope you guys can give me some advice!
查无此人2021-04-15 13:36:46
Will the countdown be done? This is the countdown of js.
Use php to calculate the remaining seconds. The current time - the publishing timestamp is the remaining seconds. . Then give the remaining seconds to the regcountdown variable
var regcountdown=30;regSendCode= $("#regSendCode"); settime(regSendCode); function settime(regSendCode) { //发送验证码倒计时 if(regcountdown == 0){ regSendCode.removeClass('disabled'); regSendCode.attr('onclick','sendemail()'); regSendCode.html("获取验证码"); regcountdown = 30; return; }else{ regSendCode.addClass('disabled'); regSendCode.removeAttr('onclick'); regSendCode.html("重新发送("+regcountdown+")"); regcountdown--; } setTimeout(function(){ settime(regSendCode); },1000); }