I have an counter on my site and I want this to pause when my site isnt focused. If I use the blur (someone leaves the focus) and someone clicks on a link that opens in a new tab and then closes the tab the focus isn't back on the previous page? Why doesnt it work? Is there a better way to do it?
$(document).blur(function(){
pause=true;
});
$(document).focus(function(){
//alert("test");
pause=false;
countdown(tmp,msg);
});