在所有移动设备上停用滚动功能 [英] Disable scrolling in all mobile devices

查看:122
本文介绍了在所有移动设备上停用滚动功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这听起来像应该有一个解决方案,它在互联网上,但我不知道为什么我找不到它。我想停用移动设备上的水平滚动。基本上试图实现这一点:

This sounds like there should be a solution for it all over the internet, but I am not sure why I cannot find it. I want to disable Horizontal scrolling on mobile devices. Basically trying to achieve this:

body{
   overflow-x:hidden  // disable horizontal scrolling.
}

这可能是相关的信息:我也不希望用户能够进行缩放:

This may be relevant information: I also have this in my head tag, because I also do not wish the user to be able to zoom:

<meta content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;' name='viewport' />
<meta name="viewport" content="width=device-width" />

感谢

推荐答案

html, body {
  overflow-x: hidden;
}
body {
  position: relative
}

相对位置很重要,我只是偶然发现。无法使其无效。

The position relative is important, and i just stumbled about it. Could not make it work without it.

这篇关于在所有移动设备上停用滚动功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆