开发者

Chrome tab switching breaks my slideshow

开发者 https://www.devze.com 2023-03-15 14:28 出处:网络
Here, you can find a sample of my slideshow. The slideshow works great as long as we stay on the page. The images fade out every 5 seconds. It uses the jQuery Cycle Lite Plugin.

Here, you can find a sample of my slideshow. The slideshow works great as long as we stay on the page. The images fade out every 5 seconds. It uses the jQuery Cycle Lite Plugin.

The bug appears when you switch to another tab in Chrome : you wait about 1 minute for example and go back to the tab where the slideshow is. Now the slideshow is kind of stopped and I don't know why. It only does that i开发者_如何学JAVAn Chrome, not in Firefox or Safari (I didn't test in IE yet). What is weirder, is that it didn't happen on the jQuery Cycle Plugin homepage, you can leave the page and go back and the slideshows are still working.

So if someone has any idea of where the bug come from, please let me know.

Thanks.


Chrome increases the minimum timer delay for inactive tabs, and by a significant amount. That is, while an active tab can run interval timers (or plain timeout timers) with a minimum delay of something like 10 or 15 milliseconds, for inactive tabs that minimum is increased to something like 1 second.

Here is a relevant Stackoverflow question on the issue, and here is another with a possible solution. When you've got a plugin that's running animations, however, it may require that that code be modified; depends on the plugin probably.


I'd like to complete this discussion. Even if Pointy pointed out what seemed to be the source of the problem, it was not. After he gave his answer I started to explore the code of the jQuery Cycle Plugin homepage to see how they managed the problem but I didn't find anything. So I copied-pasted some part of their code, still nothing the slideshow was not working. So I got angry and I copied the jquery framework script tag too and tadaaaaaaa !!!

It seems there is a problem with the jquery version 1.6.1. When I use the 1.5 version it works great.

0

精彩评论

暂无评论...
验证码 换一张
取 消