防止正文滚动(移动,本机浏览器) [英] Prevent body from scrolling (mobile, native browsers)
本文介绍了防止正文滚动(移动,本机浏览器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在三星Galaxy S5 / S6的本机浏览器上,以下CSS:
On native browser of Samsung Galaxy S5 / S6, following piece of CSS:
body {
overflow: hidden;
}
不会阻止正文滚动。
有没有解决方法?
编辑:如下所述,这可以通过向html标签添加overflow:hidden 。但这引入了一个问题,窗口滚动到顶部。
as discussed below, this can be done by adding overflow:hidden to html tag as well. But this introduces an issue where window scrolls to top.
可以防止正文滚动没有滚动副效果(页面滚动到顶部一次html,身体得到溢出:隐藏)?
注意:问题在以下环境中可重复:
Side note: issue is reproducible in following environments:
Samsung Galaxy S5 (Android 5.0) Browser: Native;
Samsung Galaxy S6 (Android 6.0.1) Browser: Native;
iPhone 5S (iOS 8.4.1) Browsers: Chrome; Safari;
iPhone 6+ (iOS 9.3.2) Browsers: Chrome; Safari;
推荐答案
试用
body {
overflow:hidden;
position:fixed;
top:0;
bottom: 0;
}
这篇关于防止正文滚动(移动,本机浏览器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文