Parallax
//Remember React.strictmode is active when testing
useEffect(() => {
setParallaxLayerMounted(true);
}, []);
const stratosRefs = useRef([]);
useEffect(()=> {
console.log( stratosRefs )
}, [parallaxLayerMounted])//It needs a higher zIndex to be visible
//We modify the intersectionObserver() option object for Parallax elements
let options = {
root: base,
rootMargin: "0px 0px -85% 0px",
threshold: 0,
}
<div>
<div className='position-fixed' style={{ height: "5em", top: 0, zIndex: 5}}>
Navbar
</div>
<Parallax pages={3.2} id='finestra' ref={parallaxRef} style={{ height: "100vh" }}>
...
</Parallax>
</div>


PreviousReact-Spring 3 useSpringValue(), useChain(), useTrail() indeterpolation and Parallax.NextReact-Spring 4 useSpring() methods, async/await springValue(), useSpring() [scriptsKeys], useLayout(), useSpring() onScroll()
Last updated