How to make java script timer work while window/tab is focused& stop when not focused on window/tab

I'am running a php script that shows links that are clickable. When these links are clicked it opens a new window displaying the link in a iframe with a progress bar timed at 1 sec intervals.

What I'm trying to get the timer to do is simply stop the progress bar timer if the window/tab is not in focus or being viewed. Then continue once window/tab is back in focus.

Any help would be greatly appreciated.

Thanks
silas82
Asked Feb 19, 2015
Edited Feb 19, 2015
Don't know javascript but maybe use blur() Method.

Got my reference from here: http://stackoverflow.com/questions/6403816/progress-bar-timer
and here:
http://www.w3schools.com/jquery/event_blur.asp
snippe
Answered Feb 19, 2015

TIP: If it's not your answer to this question, please click "Leave a Comment" button under the question to communicate with the question owner.

Categories