You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that this uses the windows scroll position, but would it be possible to add laxxx effects to the elements inside of a div that is fixed, but has overflow-y: scroll?
also curious how that might be implemented using the react hooks version as well :-)
I might have missed it in the docs, if so, my apologies :-)
The text was updated successfully, but these errors were encountered:
I just made my own hook, ala useLax, like so, directly in the component I'm parallaxing in:
functionuseLax(){constrequestRef=useRef();useEffect(()=>{lax.setup()// initializationconstelement=document.querySelector('#scroller')// Find your scrollable elementconstupdateLax=()=>{lax.update(element.scrollTop)// pass in the elements scrolled positionrequestRef.current=window.requestAnimationFrame(updateLax);};requestRef.current=window.requestAnimationFrame(updateLax);return()=>{if(requestRef.current){window.cancelAnimationFrame(requestRef.current);}};},[]);}
I see that this uses the windows scroll position, but would it be possible to add laxxx effects to the elements inside of a div that is fixed, but has
overflow-y: scroll
?also curious how that might be implemented using the react hooks version as well :-)
I might have missed it in the docs, if so, my apologies :-)
The text was updated successfully, but these errors were encountered: