Comments (3)
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.
@idiotWu great, thank you very much, works perfectly!
from smooth-scrollbar.
@idiotWu thank you so much! you save me a lot of hours!!! :D
from smooth-scrollbar.
Related Issues (20)
- SyntaxError: Cannot use import statement outside a module HOT 1
- Damping effect gone after calling ev.stopPropagation() HOT 5
- [Idea/v9] target-agnostic smooth scrolling engine HOT 2
- Anchor Tags not working with horizontal scrolling HOT 4
- Max size of scrollbar thumbs
- scrollbar.scrollTo easing not working HOT 12
- Unable to preventDefault inside passive event listener invocation. HOT 3
- `types` in `package.json` pointing at non-existent file HOT 2
- Hide scrollbar with display:none HOT 1
- auto hide doesn't work HOT 1
- Can't zoom web pages on mobile
- Always visible scrollbar HOT 2
- Next JS Demo with Custom hook
- NextJs throws error when navigating from 404 page to normal page HOT 2
- Different timings when >60Hz display connected
- virtual scroll how do we do it ?
- Sticky header of scrolled content
- cant able to float anything is their any solution
- Scrollbar not working well with column-reverse
- need an offsetTop detect indead of scrollbar.scrollIntoView HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smooth-scrollbar.