如何禁用iOS浏览器正文上的惯性滚动? [英] How to disable inertial scrolling on body for iOS browsers?

查看:741
本文介绍了如何禁用iOS浏览器正文上的惯性滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要禁用iPad上的正文元素的惯性滚动,但保留无惯性滚动页面的功能。

我一直在寻找一些时间,但我还没有找到任何好的解决方案。也许我只是不想找正确的东西?是否有任何黑客或变通办法可以使这成为可能?

解决方案



 < 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

这篇关于如何禁用iOS浏览器正文上的惯性滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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