This code is maybe the solution you wanted:
function countdown() {
var i = document.getElementById('counter');
if (parseInt(i.innerHTML)<=0) {
$("#counter").fadeout();
i.innerHTML =10;
i.style.width="100%";
$("#counter").fadein(10);
} else {
i.innerHTML = parseInt(i.innerHTML)-1;
setTimeout(function(){
var i = document.getElementById('counter');
i.style.width="10%";
i.innerHTML="1";
},5000)
}
var msg = window.open("", "Window name", "width=200, height=100");
msg.document.write("Some HTML");
}
You have to add jquery in the html head!
Leave a comment if the code doesn’t help.
1
solved on click, reduce countdown with 1 and so something, when countdown reaches 0 open window