且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何禁用iOS浏览器正文上的惯性滚动?

更新时间:2022-10-15 22:37:18



 < body> 
< div class =scroll>
长文本...
< div>
< / body>



Css

  html,
body {
height:100%;
保证金:0;
overflow:hidden;
}
.scroll {
overflow:auto;
身高:100%;
}

http://jsbin.com/palixi/edit


I need to disable the inertial scrolling on the body element for iPad, but keep the ability to scroll the page without the inertia.

I have been looking for some time but I haven't found any good solutions. Maybe I am just not looking for the right thing? Is there any hack or workaround that could make this possible?

You can use div with overflow property, it kill smooth iOS scroll

<body>
  <div class="scroll">
    long long text...
  <div>
</body>

Css

html,
body {
 height: 100%;
 margin: 0;
 overflow: hidden;
}
.scroll {
 overflow: auto;
 height: 100%;
}

http://jsbin.com/palixi/edit