How would I reverse this effect once it's about to leave the viewport?
I have it disappearing, but without any effects this way:
.fade-out-observe { width: 100%; position: absolute; } function vh() { var h = Math.max( document.documentElement.clientHeight, window.innerHeight || 0 ); return h; } useEffect(() => { const observer = new IntersectionObserver((entries) => { entries.forEach((entry) => setVisible(entry.isIntersecting)); }); observer.observe(fadeOutRef.current); return () => observer.unobserve(fadeOutRef.current); }, []); <div ref={fadeOutRef} className="fade-out-observe" style={{ top: vh() * 0.4 }} />
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
How would I reverse this effect once it's about to leave the viewport?
I have it disappearing, but without any effects this way: