在Android版Chrome上禁用动量滚动
我正在寻找一种方法来禁用用于Android设备的Chrome上的动量滚动. 我有一个固定高度的div,我希望能够滚动该div的内容,但没有平滑效果.
I'm looking for a way to disable the momentum scrolling on Chrome for Android device. I have a div with a fixed height and I want to be able to scroll the content of that div but without the smooth effect.
在iOS上很简单,我只是没有添加"-webkit-overflow-scrolling:touch",但看起来Android版Chrome会自动应用此功能.
On iOS it's easy, I just havn't add the "-webkit-overflow-scrolling: touch", but it looks like Chrome for Android apply this automatically.
当我使用Chrome检查代码->设备检查时,我没有看到此属性,因此我认为Chrome可以做到这一点,而我还没有找到防止这种情况的方法.
When I inspect the code with Chrome -> Device inspection I don't see this property so I think that Chrome do that nativly and I havn't found a way to prevent that.
我在touchend上尝试了preventDefault,但是它不起作用.
I tried preventDefault on touchend but it doesn't work.
有什么建议吗?
谢谢. :)
这是来自Chrome项目的code.google.com的引用
This is a quote from code.google.com from the chromium project
我们删除了-webkit-overflow-scrolling,希望不再需要它,因为我们会在需要时自动选择快速滚动."
"We removed -webkit-overflow-scrolling with the hopes that it was no longer necessary because we'd automatically opt-in to fast scrolling when we need."
-webkit-overflow-scrolling: touch;
该规则在2013年1月到2月之间被删除了
现在,解决这个问题的唯一方法就是在Chrome上执行类似的操作
That rule got removed somwhere between Jan and Feb in 2013
The only way to get around the problem now on Chrome something to do it like this
<div style="overflow: auto">
<div style="z-index: 0">
Content
</div>
</div>
解决方法是仅在溢出:滚动"元素上将zindex:0设置.
The fix would be to set zindex: 0 on only "overflow: scroll" elements.