jquery: slideshow, when you're in another browser tab for a bit, then go back to the tab with the slideshow, it flips out jquery: slideshow, when you're in another browser tab for a bit, then go back to the tab with the slideshow, it flips out google-chrome google-chrome

jquery: slideshow, when you're in another browser tab for a bit, then go back to the tab with the slideshow, it flips out


After investigating and testing your example links, working and non-working... I see the link that is working fine in Chrome, is actually using jquery-1.3.2 . It looks like it's working fine in Chrome using the old Jquery framework.

See the update link : http://jsfiddle.net/B7Rhe/10/


Just do this:

setInterval(function() {  var m = $('.slideshow li').size();  x += 1;  if (x > m) {    x = 1;  }  $(".slideshow ul li:visible").stop(true,true).animate({     opacity: 0  });  $(".slideshow ul li:nth-child(" + (x) + ")").stop(true,true).animate({    opacity: 1  });

}, 2000);

inactive browser tabs buffer some of the setInterval or setTimeout functions. stop(true,true) - will stop all buffered events and execute immadietly only last animation.

The window.setTimeout() method now clamps to send no more than one timeout per second in inactive tabs. In addition, it now clamps nested timeouts to the smallest value allowed by the HTML5 specification: 4 ms (instead of the 10 ms it used to clamp to).