Loading...
Tech Stunner


How to make timer based download button for opening links


Steps -


1. Copy this JavaScript code at very first.

<br />

<!-- Paste Your Adsense Code Here --> 

<br>

<center>

<span id="countdown">You have to wait 15 seconds.</span></center>

<br />

<div style="text-align: center;">

<a href="your link" id="download_link" class="btn btn-gradient gradient2"style="display: none;font-weight:bold;font-size:20px;border:1px solid #ccc;border-radius:10px;padding:10px;text-decoration:none;color:#fff;background-color:#ff5722;">Download</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>

<br />

<!-- Paste Your Adsense Code Here -->  

<br>


2. Paste it into your blog (In HTML VIEW).



3. After that customize it as per your requirements i.e. change duration and update link (shown in above code where to apply these).

4. Cheers! you created your own timer based download button, apply it to make your own url shortner as well.



LIVE PREVIEW








Post a Comment

0 Comments