Jump to content
  • 0

Custom Code for Countdown Clock

Question

Site URL: https://hwy61roadhouse.squarespace.com/

Does anyone know why I can't get the countdown clock to work on my website: https://hwy61roadhouse.squarespace.com/

Here is the code I inserted, but It doesn't seem to be working when I view the website logged out and in incognito mode?

I am using the code that was suggested on https://insidethesquare.co/countdown (see below). Has anyone else used it? 

<style>#countdown{color:#fff; display:inline-block; text-align:center; font-size:1.5rem}
#countdown>div{padding:10px; background:#0e8ba9; display:inline-block}
#countdown div>span{padding: 5px; display:inline-block} </style><center><div
id="countdown"><div><span class="days" id="day"></span><div
class="text">Days</div> </div> <div><span class="hours" id="hour"></span> <div
class="text">Hours</div> </div> <div><span class="minutes" id="minute"></span> <div
class="text"> Minutes</div></div><div><span class="seconds" id="second">
</span><div class="text">Seconds</div></div></div> <p
id="timer"></p></center><script>var deadline=new Date("feb 18, 2023
12:00:00").getTime();var x=setInterval(function(){var now=new Date().getTime();var
t=deadline-now; var days=Math.floor(t/(1000*60*60*24)); var
hours=Math.floor((t%(1000*60*60*24))/(1000*60*60)); var
minutes=Math.floor((t%(1000*60*60))/(1000*60)); var
seconds=Math.floor((t%(1000*60))/1000);
document.getElementById("day").innerHTML=days;
document.getElementById("hour").innerHTML=hours;
document.getElementById("minute").innerHTML=minutes;
document.getElementById("second").innerHTML=seconds;if(t<0)
{clearInterval(x);document.getElementById("timer").innerHTML="TIME
UP";document.getElementById("day").innerHTML='0';
document.getElementById("hour").innerHTML='0';
document.getElementById("minute").innerHTML='0';
document.getElementById("second").innerHTML='0'}},1000); </script>

CountdownCodeInstructions.jpg

CountdownCodeInSquarespace.jpg

Link to comment
  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

Posted Images

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • 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.