移动端h5页面长列表滚动问题

前置:

  • 安卓端的h5页面
  • 长列表滚动

两个问题:

1.移动端的长列表滚动直接像浏览器一样用原生/默认的滚动不行么?

2.为什么有的h5页面非要用iscroll这样的js插件来实现呢?

这里只限定滚动(不考虑滚动加载之类的效果)

阅读 6.4k
2 个回答

安卓的原生滚动没有运动曲线,非常生硬.
滚动插件提供了一些边界回弹之类的原生没有的效果

最主要的是在几年之前,原生不支持在固定区域内滚动...

Even on platforms where native scrolling is good enough, iScroll adds
features that wouldn't be possible otherwise. Specifically:

Granular control over the scroll position, even during momentum. You
can always get and set the x,y coordinates of the scroller. Animation
can be customized with user defined easing functions (bounce, elastic,
back, ...). You can easily hook to a plethora of custom events
(onBeforeScrollStart, onScrollStart, onScroll, onScrollEnd, flick,
...). Out of the box multi-platform support. From older Android
devices to the latest iPhone, from Chrome to Internet Explorer.

简单说就是,iscroll具有:

  1. 细粒度控制,可以实时获取x,y坐标。
  2. 可以定制多种动画模型
  3. 有许多好用的钩子,例如onScrollStart...
  4. 跨平台性。

此外,iscroll会根据设备和浏览器的不同,选择性能最佳的方式进行模拟滚动。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题