我有一个移动网页,我禁用了水平滚动,因为它干扰了我正在做的一些动画。但是,当我设置overflow-x:hidden
html 和 body 时,android 由于某种原因失去了垂直滚动的能力。iPad 似乎仍然可以工作。如果重要的话,我在 android 2.3 上
以下是该问题的一些示例代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style type="text/css">
html,body {
position:absolute;
height:100%;
width:100%;
padding:0px;
margin:0px;
overflow-x:hidden;
}
.content span {
white-space:nowrap;
display:block;
}
</style>
</head>
<body>
<div class="content">
<span>Really long line to force horizontal scrolling. Really long line to force horizontal scrolling. Really long line to force horizontal scrolling. Really long line to force horizontal scrolling. Really long line to force horizontal scrolling. Really long line to force horizontal scrolling. Really long line to force horizontal scrolling. Really long line to force horizontal scrolling.</span>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
</div>
</body>
</html>