Jump to content

Countdown timer

Recommended Posts

Posted (edited)

Site URL: https://www.konsulentoppdrag.no/annonsering

COUNTDOWN TIMER:

So I'm using this script:

<style>#countdown{color:#f5f2ec;display:inline-block;text-align:center;font-size:1.0rem} #countdown>div{padding:5px; background:#F2BA40; 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">D:</div></div><div><span class="hours" id="hour"></span><div class="text">T:</div></div><div><span class="minutes" id="minute"></span><div class="text">M:</div></div><div><span class="seconds" id="second"></span><div class="text">S:</div></div></div><p id="timer"></p></center><script>var deadline=new Date("June 1,2022 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>

1. I want the numerics to the bottom and text to the top?
2. Also make the block 100%transparent?

Edited by JakeLake
new info
  • Replies 6
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Posted
On 5/25/2022 at 1:59 PM, JakeLake said:

No, I want the numbers at the bottom please.

Edit this code

<center><div id="countdown"><div><span class="days" id="day"></span><div class="text">D:</div></div><div><span class="hours" id="hour"></span><div class="text">T:</div></div><div><span class="minutes" id="minute"></span><div class="text">M:</div></div><div><span class="seconds" id="second"></span><div class="text">S:</div></div></div><p id="timer"></p></center>

to this

<center>
  <div id="countdown">
    <div>
      <div class="text">D:</div>
      <span class="days" id="day"></span>
    </div>
    <div>
      <div class="text">T:</div></div>
    <span class="hours" id="hour"></span>
    <div> 
      <div class="text">M:</div></div>
    <span class="minutes" id="minute"></span>
    <div>
      <div class="text">S:</div></div>
    <span class="seconds" id="second"></span>
  </div>
  <p id="timer"></p>
</center>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted
21 hours ago, abibacon said:

Hi Tuan, 

This didn't work for me, ideally I want code to replicate a countdown to look like the one in the attached screenshot. Any suggestions?

 

Thanks,
Abi

Screenshot 2022-05-31 at 11.10.50.png

You can share link to page where you added countdown, we can check & tweak code easier

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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.