Jump to content

Embedded Countdown JS not showing up

Recommended Posts

Site URL: https://www.saas-day.com/

Hello everyone!

I am currently struggling a bit with a countdown embedded script that just won't show on the page. I am currently using a Harris template from the York family and I would like to have a solution that does not imply to switch off Ajax loading.

Here's the code:

<center>

<h2 id="timer"></h2>

</center>

<script>

var countDownDate = new Date("Mar 11,
2021 09: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("timer").innerHTML = days + " Tage " + hours + " Std "+
minutes + " Min " + seconds + " Sek ";if (distance < 0)
{clearInterval(x);document.getElementById("timer").innerHTML = "";} }, 1000);

</script>

Thanks a lot for your help!

 

Link to comment
  • Replies 3
  • Views 385
  • Created
  • Last Reply
1 hour ago, Drewster said:

Site URL: https://www.saas-day.com/

Hello everyone!

I am currently struggling a bit with a countdown embedded script that just won't show on the page. I am currently using a Harris template from the York family and I would like to have a solution that does not imply to switch off Ajax loading.

Here's the code:

<center>

<h2 id="timer"></h2>

</center>

<script>

var countDownDate = new Date("Mar 11,
2021 09: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("timer").innerHTML = days + " Tage " + hours + " Std "+
minutes + " Min " + seconds + " Sek ";if (distance < 0)
{clearInterval(x);document.getElementById("timer").innerHTML = "";} }, 1000);

</script>

Thanks a lot for your help!

 

Hvae you tried using code block instead of embed? 

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.