iOS Javascript DOM“冻结” [英] iOS Javascript DOM "Freezing?"

查看:141
本文介绍了iOS Javascript DOM“冻结”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有几个问题:


  1. 滚动还是保持iOS在页面上冻结javascript? p>


  2. 当您在另一个标签页或您是否切换应用程序时,iOS会否冻结JavaScript?


  3. iOS上还有其他主要的javascript限制?



解决方案

iOS 6.x暂停所有事件计时器以响应诸如滚动的触摸事件,并且一旦事件完成,就不会再次启动所有定时器。这是一个众所周知的iOS 6错误,这是非常烦人的。它几乎打破了视差和东西。有些人已经采用了自己的滚动功能。



这是另一个同一主题的StackOverflow:
iOS 6 safari,setInterval没有被触发



和另一个:
iphone / ipad中的setInterval暂停Safari)在滚动



这里是最接近你的错误报告的事情(苹果公司不会公开bug维护完美的错觉,所以开发人员自己的bug网站): http://openradar.appspot.com/12756410



这一段代码将解冻在页面滚动期间由iOS破坏/丢失/销毁的定时器: https://gist.github.com/ronkorving/3755461



这是另一个修复冻结的尝试: iOS 6 js事件功能未调用如果有setTimeout在其中



不幸的是,没有什么可以做的事情触发事件WHILE页面滚动。喜欢在向上滚动页面时淡出一个back-to-top链接。当涉及到滚动时,iOS6无法揉搓它的肚子,拍拍它的头。 (iOS5工作正常,btw。这是一个回归)


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?

解决方案

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.com/12756410

This bit of code will unfreeze timers that are broken / lost / destroyed by iOS during a page scroll: https://gist.github.com/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 comes to scrolling, iOS6 is incapable of rubbing it's tummy and patting it's head. (iOS5 works fine, btw. This is a regression)

这篇关于iOS Javascript DOM“冻结”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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