最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

iOS Javascript DOM "Freezing?" - Stack Overflow

programmeradmin1浏览0评论

A few questions here:

  1. Is there anyway to keep iOS from freezing javascript on the page while scrolling?

  2. Does iOS freeze javascript when your in another tab or if you switch apps?

  3. Are there any other major javascript limitations on iOS?

A few questions here:

  1. Is there anyway to keep iOS from freezing javascript on the page while scrolling?

  2. Does iOS freeze javascript when your in another tab or if you switch apps?

  3. Are there any other major javascript limitations on iOS?

Share Improve this question asked Dec 2, 2011 at 19:57 James KyleJames Kyle 4,1784 gold badges29 silver badges42 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

iOS 6.x suspends all event timers in response to touch events like scrolling and has a tendency not to start up all the timers again once the event is done. It's a well known iOS 6 bug that is super-annoying. It pretty much breaks parallax and stuff. Some people have resorted to building their own scroll functionality.

Here's another StackOverflow on the same topic: iOS 6 safari, setInterval doesn't get fired

and another: setInterval pauses in iphone/ipad (mobile Safari) during scrolling

and here is the closest thing you'll get to a bug report on it (Apple doesn't make bug reports public to maintain the illusion of perfection, so developers made their own bug site): http://openradar.appspot./12756410

This bit of code will unfreeze timers that are broken / lost / destroyed by iOS during a page scroll: https://gist.github./ronkorving/3755461

This is another attempt to fix the freeze: iOS 6 js events function not called if has setTimeout in it

Unfortunately, there is nothing you can do to fire events WHILE page scrolling. Like fade out a back-to-top link when scrolling up the page. When it es to scrolling, iOS6 is incapable of rubbing it's tummy and patting it's head. (iOS5 works fine, btw. This is a regression)

To answer the third question, a decent-sized limitation is that sometimes innerHTML just plain doesn't work. From the accepted answer:

It happens when the CPU of the phone is very busy (say 100%). Then the rendering engine sometimes forget about innerHTML settings.

The solution included in my unify project is to test if there is an element in childNodes, otherwise apply it again.

发布评论

评论列表(0)

  1. 暂无评论