Html 页面未在移动设备中垂直滚动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34944184/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
page is not scrolling vertically in mobile devices
提问by Coder
I'm working on a project. There is an issue on the front end side. The site is responsive, but when I view it in mobile width (specially for iPhone 4 & 5), the vertical scroll doesn't work.
我正在做一个项目。前端有问题。该网站具有响应性,但是当我以移动宽度(特别是 iPhone 4 和 5)查看它时,垂直滚动不起作用。
I'm not using any div that needs scrolling, the whole page is not scrolling vertically, I'm afraid I can't provide the code. The thing I wanna know is why does this happens? and what would I've possibly done wrong?
我没有使用任何需要滚动的div,整个页面没有垂直滚动,恐怕我无法提供代码。我想知道的是为什么会发生这种情况?我可能做错了什么?
1) I have added -webkit-overflow-scrolling:touch
on body tag but my chrome browser is not picking it up and saying invalid property.
1) 我添加-webkit-overflow-scrolling:touch
了 body 标签,但我的 chrome 浏览器没有选择它并说无效的属性。
2) I have added body{overflow-y:scroll,position:relative}
Now its showing a scroll but there is no bar between the scroll, and its pretty much stuck there.
2)我添加了body{overflow-y:scroll,position:relative}
现在它显示一个滚动但滚动之间没有栏,它几乎卡在那里。
回答by Mukul Kant
I think its because of position
and z-index
the z-index
value make problem in your small screen.
我认为它的,因为position
和z-index
在z-index
你的小屏幕值化妆问题。
Its possible that the element which have high z-index
value. stopping you for scroll.
它可能是具有高z-index
价值的元素。阻止你滚动。
and It can be possible you have overflow:hidden
in wrong place. It will be good, If you show some code of line or your site link.
并且您可能overflow:hidden
在错误的地方。如果您显示一些行代码或您的站点链接,那就太好了。