ios 6 uiwebview使用jquery scrolltop滚动页面时显示背景 [英] ios 6 uiwebview shows background while scrolling a page using jquery scrolltop

查看:140
本文介绍了ios 6 uiwebview使用jquery scrolltop滚动页面时显示背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页显示在UIWebView中,该网页使用jquery scrollTop(使用1.6.4版本的jquery)在页面加载后将窗口滚动到一个speicified位置。这对于xcode早于4.5的版本工作正常。在使用xcode 4.5构建它之后,页面会在滚动之前暂时显示UIWebView的背景。

I have a web page being displayed in a UIWebView that uses jquery scrollTop (using 1.6.4 version of jquery) to scroll the window to a speicified position after the page is loaded. This was working fine with xcode older than 4.5. After I built it using xcode 4.5 the page momentarily shows the background of the UIWebView before scrolling.

这仅在ios6中发生。有没有人遇到过与xcode 4.5和ios6类似的问题?
是否有任何新的UIWebview API可以用来阻止这种恼人的行为?

This happens only in ios6. Has anyone encountered any similar issue with xcode 4.5 and ios6? Is there any new API for UIWebview that I can use to stop this annoying behaviour?

推荐答案

解决了这个问题,这里是以后有人在这个问题上遇到问题的解决方案:

Solved this, here is the solutions in case anyone stumbles over this issue in future :

当您使用jQuery ScrollTop滚动窗口或文档或页面正文时,显然在iOS6 UIWebView中UIWebview瞬间显示UIWebview的背景。对此的简单修复是,我们应该使div可滚动(用户溢出:自动)并在其上使用scrollTop。现在scrollTop将工作,并将div滚动到您提供的正确位置,但令人惊讶的是,UIWebview中的可滚动div中的滚动将不顺畅(读取可怕)所以我们必须包含CSS标记(仅适用于ios5及以上版本称为-webkit-overflow-scrolling:touch;一切都神奇地起作用。

Apparently in iOS6 UIWebView when you use the jQuery ScrollTop to scroll the window or document or body of a page the UIWebview flickers showing the background of the UIWebview momentarily. The simple fix for this is that instead we should make a div scrollable(user overflow:auto) and use scrollTop on that. Now scrollTop will work and will make the div scroll to the proper position supplied by you, but surprises surprises, the scrolling in a scrollable div in UIWebview will be not smooth (read horrible) so we have to include a CSS tag (works only on ios5 and above) called -webkit-overflow-scrolling: touch; and everything magically works.

干杯!!

这篇关于ios 6 uiwebview使用jquery scrolltop滚动页面时显示背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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