I have a timer set on my application using html 5 and jquery. Now when I move on to different tab or I minimize my window, the timer for that few seconds stops. And again as I open the window(tab or browser page, whatever u say)the timer starts. But it gets pause for those seconds. What should be the issue ? What code should I write for it ?
Code for getting the timer is:
Here the timer is set and it runs, but as soon as i move my focus to other page, the timer is paused. A function is just shown here.
function showTime()
{
if(ms>=100){
ms = 0;
s++;
}
// calculates seconds and hours also
var temp= $("#clock").text(checkTime(h)+":"+checkTime(m)+":"+checkTime(s)+"."+checkTime(ms));
timer=setTimeout('showTime()', 10);
}
checktime is a function which just add a zero in front of numbers<10.