Giter VIP home page Giter VIP logo

Comments (3)

idiotWu avatar idiotWu commented on June 3, 2024 20

Since transform creates a new local coordinate system(W3C Spec), position: fixed is fixed to the origin of scrollbar content container, i.e. the left: 0, top: 0 point.

So it's recommended to put your fixed element outside the scrollbar contents, or you may need to register a scroll listener and apply offsets to the fixed element.

FYI:

const scrollbar = Scrollbar.init(elem, {
    // execute listeners synchronously to make sure they can be rendered at same tick
    syncCallbacks: true,
});

scrollbar.addListener(({ offset }) => {  
  fixed.style.top = offset.y + 'px';
  fixed.style.left = offset.x + 'px';
});

A working demo is here: http://jsbin.com/tuqafof/edit

from smooth-scrollbar.

igorpreston avatar igorpreston commented on June 3, 2024

@idiotWu great, thank you very much, works perfectly!

from smooth-scrollbar.

Jero786 avatar Jero786 commented on June 3, 2024

@idiotWu thank you so much! you save me a lot of hours!!! :D

from smooth-scrollbar.

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.