In this guide we will show you how to display count down across all the nodes in your DT. And then additionally redirect out of LeadsHook when the countdown completes.

Here’s the code:

#minutes, #seconds{
display: inline-block;
background-color: #FF1493;
border-radius: 10px;
color: white;
width: auto;
margin-left: 10px;
padding: 14px;
width: 100%;
margin: auto;
text-align: center; 
  #minutesTxt, #secondsTxt{
  font-size: 27px;}

var given_seconds = 15; //fifteen seconds
setInterval(function() {
    // Count down by one second
    // Calculate hour/mins/sec's based on given seconds
    hours = Math.floor(given_seconds / 3600);
    minutes = Math.floor((given_seconds - (hours * 3600)) / 60);
    seconds = given_seconds - (hours * 3600) - (minutes * 60);
      // Format the time with two digits per hour/mins/sec's
    minutesString = minutes.toString().padStart(2, '0') + '';
    secondsString = seconds.toString().padStart(2, '0') + '';
    // Print the current time so far
    document.getElementById("minutesTxt").innerHTML = minutesString;
	  document.getElementById("secondsTxt").innerHTML = secondsString;
    // Check if countdown is complete & redirect
    if (given_seconds==0)'';

}, 1000); // Update about every second

<p>Countdown Demo</p>

<div class="holder">
  <div id="minutes"><span id="minutesTxt"></span><br>Minutes</div><div id="seconds"><span id="secondsTxt"></span><br>Seconds</div>  

Simply copy paste the code to the HTML section in your appearance settings.

You can see a working demo here:

You can download a copy here:

Leave a Reply

Your email address will not be published. Required fields are marked *