1

我正在使用jquery.countdown.js一个简单的倒计时时钟。在 Safari 桌面和 iPhone 上的 Safari 上,“秒”出现错误,显示为NaN. 它适用于所有其他浏览器。有什么我需要调整的吗?

下面是我的代码:

$(function () {
  $(".countdowntoChristmas").countdown({
    date: "December 24, 2020 24:00 EDT",
    render: function (data) {
      var el = $(this.el);
      totalHours = data.days * 24 + data.hours;
      el.empty()
        .append(
          "<span class='time time-h'>" +
            this.leadingZeros(totalHours, 2) +
            "</span>"
        )
        .append(
          "<span class='time time-m'>" +
            this.leadingZeros(data.min, 2) +
            "</span>"
        )
        .append(
          "<span class='time time-s'>" +
            this.leadingZeros(data.sec, 2) +
            "</span>"
        );
    }
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/easy-countdown/2.2.0/jquery.countdown.min.js"></script>

<div class="christmas-countdown">
  <div class="christmas-left">
    <strong
      >Its beginning to look a lot like<br />
      Christmas!</strong
    >
  </div>
  <div class="countdowntoChristmas"></div>
  <div class="christmas-right">
    Everywhere you<br />
    <strong>GO!</strong>
  </div>
</div>

4

0 回答 0