使用better-scroll解决IOS上滑动事件不能实时触发的问题

import BScroll from “better-scroll”;
this.scroll = new BScroll(this.$refs.my_property, {
probeType: 3,
click: true,
bounce: false
});
this.scroll.on(‘scroll’, (pos) => {
let y = pos.y;
// console.log(y);
if (y >= 0) {
}
});
this.scroll.on(‘scrollEnd’, (pos) => {})

当 ProbeType 为 1 的时候,会非实时(屏幕滑动超过一定时间后)派发 scroll事件;
当 ProbeType 为 2 的时候,会在屏幕滑动的过程中实时的派发scroll事件;
当 probeType 为 3 的时候,不仅在屏幕滑动的过程中,而且在 momentum 滚动动画运行过程中实时派发 scroll 事件。
如果没有设置该值,其默认值为0 ,即不派发 scroll事件。

bounce: false关闭better-scroll滚动到最底部或者顶部的弹性效果(防止拉到顶部还可以继续往下拉 出来一块空白问题)

容器要有固定高度
fixed元素要放在容器外

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值