how to add countdown timer button in blogger post by vloggerx


Now I will show how to add download button with timer seconds


1) Open the blog post with HTML view

2) Just copy the below code

Start copying from here


👇👇👇

<div dir="ltr" style="text-align: left;" trbidi="on">
<center>
<span id="countdown">You have to wait 15 seconds.</span></center>
<br />
<div style="text-align: center;">
<b>Generating Download Link...</b><br />
<a class='button' href="#" target="_blank" id="download_link" style="display: none;">Download Now</a>
<noscript>JavaScript needs to be enabled in order to be able to download.</noscript>
<script type="application/javascript">
(function(){
   var message = "%d seconds before download link appears";
   // seconds before download link becomes visible
   var count = 15;
   var countdown_element = document.getElementById("countdown");
   var download_link = document.getElementById("download_link");
   var timer = setInterval(function(){
      // if countdown equals 0, the next condition will evaluate to false and the else-construct will be executed
      if (count) {
          // display text
          countdown_element.innerHTML = "You have to wait %d seconds.".replace("%d", count);
          // decrease counter
          count--;
      } else {
          // stop timer
          clearInterval(timer);
          // hide countdown
          countdown_element.style.display = "none";
          // show download link
          download_link.style.display = "";
      }
   }, 1000);
})();
</script></div></div>

👆👆👆

Here the ending of copying 



3) If you guys want to change the timer 15sc you can change as your wish.

4) And next you can add your download link in this HTML code. "#" replace the code in this area

5) Your download button with timer seconds was ready you can publish your post now this is very simple.

If you guys have any more doubts you can watch video.

0 Comments