1

我有一个移动网页,我禁用了水平滚动,因为它干扰了我正在做的一些动画。但是,当我设置overflow-x:hiddenhtml 和 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>
4

1 回答 1

0

我有一个类似的问题,但从我所看到的到现在,阻止滚动的是

height: 100%;

尝试评论 Android 2.X 的留置权,你可能会让它再次滚动。

如果您找到可以保留的方法,请告知

html, body {
height: 100%;
}

并且仍然滚动。

谢谢,祝你好运-

于 2013-07-31T18:10:08.807 回答