Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
590 views
in Technique[技术] by (71.8m points)

javascript - setInterval pauses in iphone/ipad (mobile Safari) during scrolling

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...