Giter Site home page Giter Site logo

关于黄老师用bscroll做联系人列表的每一项滚动到顶部后列表组标题切换固定的问题 about better-scroll HOT 1 CLOSED

ustbhuangyi avatar ustbhuangyi commented on May 12, 2024
关于黄老师用bscroll做联系人列表的每一项滚动到顶部后列表组标题切换固定的问题

from better-scroll.

Comments (1)

neurotoxinvx avatar neurotoxinvx commented on May 12, 2024 1

在创建 BScroll 的时候你可以计算每个列表组标题距离 BScroll 顶部的距离是多少 ,在 on('scroll') 的时候 BScroll 会派发给你当前已滚动的 y 值,如果 y 值 >= 每个列表组标题距离 BScroll 顶部的距离,即为已滚到了这个列表组 title ,你可以开始进行 fixed-tilte 的操作。具体实现的时候由于 fixed-title 本身也具有 height ,所以判断是否接壤的时候要减去 fixed-title 的高度哦。另外需要注意的地方是,由于 fixed-title 会根据滚动的距离进行一个位置的上移动画,实例化 BScroll 的时候一定要选择 probeType: 3 实时派发滚动事件。

from better-scroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.