UIWebView和CSS固定位置 [英] UIWebView and CSS fixed position
问题描述
我有一个使用固定位置标题的 UIWebView
。
当包含
是初始视图,固定位置div没有问题。 UIWebView
的ViewController
当我通过Modal segue显示相同的 ViewController
时,就是问题发生时。
第一次在页面上滚动时,div会随着页面移动和滚动,但是一旦我第一次放开滚动条,div就会返回固定位置,错误不会再次发生。
任何想法?我看到 iScroll
,它不工作,我想要的页面,我想有一个更容易的方式,因为我只得到的初始负载的问题 我使用CSS解决方法,将标题定位在左上角的绝对位置,并给予< div>
一个 overflow-y:scroll;
,并保持 body {height:100%; }
EDIT
此外,您还可以插入:
-webkit-overflow-scrolling:touch;
进入主要< div>
css为更多的本土感觉。
I have a UIWebView
that uses a fixed position header.
When the ViewController
that contains the UIWebView
is the initial view, there is no problem with the fixed position divs.
When I display that same ViewController
through a Modal segue, that's when the problem occurs.
The first time I scroll on the page, the divs move and scroll with the page, but once I let go of scrolling for the first time, the div returns to its fixed position and the error never happens again.
Any ideas? I've seen iScroll
, it doesn't quite work like I want the page too, and I think there's an easier way, since I only get the problem on the initial load of the UIWebView
...
I used a CSS workaround, positioning the header as absolute in the top left corner, and giving the main <div>
an overflow-y: scroll;
, and keeping the body { height: 100%; }
.
This resulted in kind of a knock-off iScroll!
EDIT
Also, you can insert this:
-webkit-overflow-scrolling: touch;
Into the main <div>
css for a more native feel.
这篇关于UIWebView和CSS固定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!