目前正在开发一个带有 slider 的网站,该 slider 在 Chrome 中出现问题,并且已经成为一个问题。
http://firedogpr.com/index.php - 带有 5 张幻灯片的顶部横幅,使用 jquery Blend 往往不会随机加载某些图像,并且在网站上运行大约 5-10 分钟时会加速或停止工作。我有另一个网站使用不同的 slider ,也出现了同样的问题,所以它可能不仅仅是插件的问题。我按照 http://www.snowdenindustries.com/ 上的 slider 对其进行了建模事实上,使用了相同的 js 文件和 div 标签,尽管效果很好。
Firefox 中出现的问题很少,但通常是在更改选项卡时出现。
有什么想法吗?
在 Mac OSX 上使用 Chrome 17.0.963.46
更新:在 Windows 中的 Chrome、Firefox 或 IE 上根本不起作用。我合作伙伴的 Mac 笔记本电脑在他的浏览器中也遇到了同样的问题。
最佳答案
来自Chromium blog :
Unfortunately, setTimeout and setInterval don’t take into consideration whether the destination element, or even the tab that contains it, is actually visible. So, pages with high-frequency timers will consume CPU resources even if the tab is in the background. On laptops, netbooks, and mobile devices of all kinds, reducing CPU consumption is essential in order to prolong battery life. Additionally, excess CPU consumption by background tabs reduces the smoothness of animations on the foreground tab. ...
In the forthcoming Chrome 11 release, we plan to reduce CPU consumption even for pages that are using setTimeout and setInterval. For background tabs, we intend to run each independent timer no more than once per second. This change has already been implemented in the Chrome dev channel and canary builds. While there may be some compatibility impact for web pages, we believe that improving the user experience for the foreground tab, and increasing battery life, are problems needing to be addressed.
关于javascript - jQuery slider 在 Chrome 中表现得很奇怪(+其他问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9279603/