ios 6 uiwebview shows background while scrolling a page using jquery scrolltop

倖福魔咒の 提交于 2019-12-24 00:31:38

问题


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.

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?


回答1:


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

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.

Cheers !!



来源:https://stackoverflow.com/questions/12578618/ios-6-uiwebview-shows-background-while-scrolling-a-page-using-jquery-scrolltop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!