Hello coders in the house.
I am a complete beginner, i saw something on thewpclub. Net and i want to implement the same on my WordPress blog.
When someone click a download link, i want another browser tab to open and display a countdown timer like 15 seconds before the main download link will now appear.
Pls try and download from thewpclub. Net , you will understand what am trying to say.
What I have tried:
A friend on facebook gave me this jquery code.
But after i paste it in my blog.
The countdown just happen righaway on the same post page. It doesnt even wait for user to click the link not to talk of opening a new tab.
See the code below
jQuery code:
function c(){
var startTime = $('.c').attr('id');
var counter = startTime;
$('.c').text(counter);
setInterval(function() {
counter--;
if (counter > 0) {
$('.c').text(counter);
}
if (counter === 0) {
clearInterval(counter);
$('.c').text('');
$('.c').append('<a href="#">Download</a>');
}
}, 1000);
}
c();
HTML:
<span class="c" id="5"></span>