android webview overflow cannot be disabled

北城以北 提交于 2019-12-23 18:28:13

问题


I have a local page in android webview, pages's html and body both has width:100%;height:100%;overflow:hidden; , and the #result-popup-wrap has the following css:

#result-popup-wrap {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 245px;
background: #fbfbfb;
border-top: 1px solid #dcd9d5;
-webkit-transform: translateY(100%);
}

but, as you see, when I scroll to bottom of the page, I can see the #result-popup-wrap, which should not be visible.

Any help is appreciated!


回答1:


Just for anyone who are suffering the same problem.

ADD position:relative to the <body> tag.

Apparently, this is a bug of WebView, on both Android and iOS. On chrome of PC version, page renders OK without body{position:relative;}, but in WebView, you can scroll the entire page, including the 'hidden' #result-popup-wrap.

click here to see demo , pay attention to the UPPER comment in css




回答2:


you can set body{position:fixed;top:0} to the body.



来源:https://stackoverflow.com/questions/28423651/android-webview-overflow-cannot-be-disabled

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