未命名 发表于 2021-12-27 09:00:35

jq实现倒计时以及完成以后进行操作使用

function count(wait) {
            function time() {
                if (wait == 0) {
                   //倒计时完成以后进行操作
                } else {
                  $("#varifyCode").show().text(wait + "s");//显示倒计时数字
                  wait--;
                  setTimeout(function () {
                        time();
                  }, 1000)
                }
            }
            time();
      }
   
count(60);<span style="color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 27.6px; background-color: rgb(255, 255, 255);"> </span>
页: [1]
查看完整版本: jq实现倒计时以及完成以后进行操作使用