在滚动期间,setInterval在iphone / ipad(移动版Safari)中暂停 [英] setInterval pauses in iphone/ipad (mobile Safari) during scrolling

查看:525
本文介绍了在滚动期间,setInterval在iphone / ipad(移动版Safari)中暂停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站中使用setInterval函数,它在IE,Chrome,Firefox和Safari中运行良好。当我在ipad / iphone(safari mobile)上尝试时,我遇到问题:如果我滚动屏幕,setInterval函数会暂停,只有当我停止滚动时它才会恢复!

I use the setInterval function in a website, and it works fine in IE, Chrome, Firefox and Safari. When i try it on ipad/iphone (safari mobile) i get problem: if i scroll the screen, the setInterval function pauses and it resumes only when i stop scrolling!

有没有办法防止该功能暂停?
谢谢

is there a way to prevent the function from pausing? Thanks

推荐答案

我不敢,没有办法阻止这种行为。这里有很多关于这个问题的主题(更多 - 相关性更少),这里特别是有趣的一个。它的摘要很简单:

I'm afraid no, there's no way to prevent such behaviour. There's a plenty of topics here in SO about this problem (more-o-less related), here's a particularly interesting one. Its summary is simple:


无法跟踪iOS弹性滚动。没有事件监听器
+滚动期间不执行超时/间隔。而且因为在iOS5中没有requestAnimationFrame,这似乎不可能以
求解。

iOS elastic scroll can't be tracked. There's no event listener for it + both timeout / interval doesn't execute during scroll. And because there's no requestAnimationFrame in iOS5, this seems impossible to solve.

这篇关于在滚动期间,setInterval在iphone / ipad(移动版Safari)中暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆