I am currently facing an issue with a scroll effect that I'm trying to implement in React.
Here is the desired effect , I was able to implement it in react using ChatGPT, as long as all the panels have a fixed height of 100vh for example the scroll effect works as inteled.
For demo I've set up this codesandbox example
The issue is that the div with the double-panel class a a height of 200vh, this seems to break the scroll effect due to the fixed position of panel-fixed and panel-inner.
Once a reach a panel with a height of over 100vh I should be able to scroll over it, without it being fixed and it should be fixed only after its bottom reaches the bottom of the page.
How should I proceed?
You'd want to look at comparing the bottom Y values:
Then you may wish to avoid the jumps that happens, with the inner content of the double panel being
fixed back totop: 0and when elements are taller than themin-heightof the.panelparent:You could also consider this CSS-only solution using
position: sticky: