0
私はクロムの中で働いているカウントダウンタイマーを持っていますが、私がサファリで見ると、すべての数字のNANが表示され、過去に日付を設定すると、 elseステートメントで。私は解決のためにネット全体を見てきましたが、何も見つけられませんでした。サファリでカウントダウンタイマーが機能しない
$(document).ready(function() {
$('#popupTimer').delay(1000).fadeIn(600);
// Set the date we're counting down to (*** Set to Apr 9th after testing ***)
var countDownDate = new Date("Apr 3, 2017 24:00:00").getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now an the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance/(1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24))/(1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60))/(1000 * 60));
var seconds = Math.floor((distance % (1000 * 60))/1000);
// Display the result in the element with id="display"
document.getElementById("display").innerHTML = days + " Days " + hours + " Hours " + minutes + " Minutes " + seconds + " Seconds ";
// If the count down is finished,
if (distance < 0) {
clearInterval(x);
document.getElementById("display").innerHTML = "EXPIRED";
$('#myModal').modal('show');
$(".myDIV").hide();
$('#chooseProductThree').show();
$(".panel-heading").addClass("active-panel");
}
}, 1000);
});
あなたは、Windowsのデバイスからテストを行うのですか? – Konstantinos
@ Constantinos TestesがMacで行われたかもしれない –
Safariが新しいDate getTimeを認識しない可能性がありますので、Date.parseで変更してください。@Cory Kelly – Konstantinos