问题
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.
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.
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.
I tried preventDefault on touchend but it doesn't work.
Any suggestion ?
Thanks. :)
回答1:
This is a quote from code.google.com from the chromium project
"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;
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>
The fix would be to set zindex: 0 on only "overflow: scroll" elements.
来源:https://stackoverflow.com/questions/25507566/disable-momentum-scrolling-on-chrome-for-android