Jump to content

Countdown Timer code stopped working after upgrade

Recommended Posts

Site URL: https://www.chaletvanblanc.com

Hi all,

HELP

I  had a working countdown timer on my site using the following code, and when I connected my domain (bought through square space) and upgraded my plan, the code stopped working...

<center><h2 id="timer"></h2></center><script>var countDownDate = new Date("Nov 1, 2022 00: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 + "d " + hours + "h "+ minutes + "m " + seconds + "s ";if (distance < 0) {clearInterval(x);document.getElementById("timer").innerHTML = "and we're off!";} }, 1000); </script>

Any ideas?

Thanks in advance...

Maximus

Screenshot 2021-10-31 at 09.29.28.png

Link to comment
  • Replies 2
  • Views 539
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

9 minutes ago, Maximus said:

Sorted, they just wanted more money... 🙂

Custom javascript code require business plan or higher

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

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.