CountDown with changing content of the index
Posted: Fri Jan 13, 2023 6:35 pm
This Script was create for launch pages
With this you can show the countdown and other message you like
When the countdown finish and they load this page
Code: Select all
<script>
var countDownDate = new Date("Sept 29, 2022 3:00:00").getTime();
var x = setInterval(function() {
var now = new Date().getTime();
var distance = countDownDate - now;
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);
document.getElementById("countdown").innerHTML = days + " Days " + hours + " Hours " +
minutes + " Minutes " + seconds + " Seconds ";
if (distance < 0) {
clearInterval(x);
document.querySelector("#div1").style.display = "block";
document.getElementById("demo").style.visibility = "hidden";
}
}, 1000);
</script>Code: Select all
<div id="demo" class="main-wrap rounded-border-window">
We show the countdown with
<div id="countdown"></div>
</div>Code: Select all
<div class="main-wrap rounded-border-window" id="div1" style="display:none;">
CountDown Finish now they show the page
</div>