1
cyanBlick();
var intervalID;
intervalID = setInterval(cyanBlick, 7000);

function cyanBlick() {
    $(".anim").each( function(indx, element) {
        $(element).delay(indx * 1000).fadeIn(250).delay(500).fadeOut(250);
    });
}

I have code for animating elements with class .anim. Interval 7sec. But when I leave page in non-active tab, and return after some time, animation don't work in non-active tab. I see chaotic fading elements. Can you tell some solution for this problem?

UPDATE

http://jsfiddle.net/uNmks/

link with animation

user1035867
  • 31
  • 1
  • 3
  • 1
    mind posting a live example on jsfiddle.net? The problem is not that the tab goes inactive. It has to do with the way you call your animation. – OptimusCrime Nov 11 '11 at 08:44

2 Answers2

1

Interval timers may be slowed down, delayed or stopped when a tab window is not visible in Firefox or Chrome. One solution is to stop the animation when the window is no longer visible and restart it again when it become visible.

See my previous post on this topic for other work-around ideas.

Community
  • 1
  • 1
jfriend00
  • 683,504
  • 96
  • 985
  • 979
0

See the second note at http://api.jquery.com/animate/#notes-0

Boris Zbarsky
  • 34,758
  • 5
  • 52
  • 55