Skip to content
Discussion options

You must be logged in to vote

Hi,

You can use addListener event and store scroll position with CSS variables like

const root = document.documentElement;
scrollbar.addListener(( { offset } ) => {
   root.style.setProperty('--scrollbar-position-y', offset.y);
});

// when you need the variable
getComputedStyle(document.documentElement).getPropertyValue('--scrollbar-position-y');

Or use GSAP ScrollTrigger + ScrollTrigger scrollerProxy

https://codepen.io/GreenSock/pen/oNLqgBm

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@maksderylo
Comment options

Answer selected by maksderylo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
FAQ
Labels
None yet
2 participants