Mobile HTML: keep scrolling after touch is ended

不打扰是莪最后的温柔 提交于 2019-12-23 04:42:00

问题


I created a HTML list that I show on mobile devices:

<ul>
    <li>...</li>
    ...
</ul>

When I touch display and start moving my finger this long list will be also scrolled. However, what I want to achieve is that when I move my finger away from the screen, this list should still scrolling for a moment. If you start iPhone 5S native email client, you can see such effect.

Right now, if I move my finger from the screen, iPhone stop scrolling immedeately and it doesn't feel good from usability point of view.

A CSS solution would be the best one because I try to reduce the amount of javascript code used in my mobile apps.


回答1:


Try:

body {
    -webkit-overflow-scrolling: touch;
} 

If your list is in a different scrolling container, then add -webkit-overflow-scrolling: touch; to that container as well.



来源:https://stackoverflow.com/questions/20407460/mobile-html-keep-scrolling-after-touch-is-ended

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!