文章预览
在移动端,如果你使用过 overflow: scroll 生成一个滚动容器,会发现它的滚动是比较卡顿,呆滞的。为什么会出现这种情况呢? 因为我们早已习惯了目前的主流操作系统和浏览器视窗的滚动体验,比如滚动到边缘会有回弹,手指停止滑动以后还会按惯性继续滚动一会,手指快速滑动时页面也会快速滚动。而这种原生滚动容器却没有,就会让人感到卡顿。 首先,让我们来看一下它是怎样让滚动更流畅的吧。 < html > < head > < meta charset = "UTF-8" /> < meta name = "viewport" content = "width=device-width, initial-scale=1.0" /> < title > Document title > head > < body > < div id = "app" > div > < template id = "tpl" > < div class = "wrapper" ref = "wrapper" @ touchstart.prevent = "onStart" @ touchmove.prevent = "onMove" @ touchend.prevent = "onEnd" @ touchcanc
………………………………