More Scroll Snippets
Scroll Split Panels — Free GSAP ScrollTrigger Curtain Reveal
Scroll Split Panels · Scroll · Plain HTML, CSS & JS · Live preview
What's included
Features
About this UI Snippet
Scroll Split Panels — Part the Curtains to Reveal Content

Scroll split panels is the reveal where two halves of a cover slide apart — left goes left, right goes right — as you scroll, uncovering a headline or media sitting behind them like curtains opening on a stage. This snippet builds it with GSAP and ScrollTrigger (from a CDN), plus plain HTML and CSS.
Two halves over a hidden center
The stage layers three pieces: a centered content block at z-index: 0 and two absolutely-positioned halves at z-index: 2 that cover it. Each half is just over 50% wide so they meet with no seam down the middle at rest. Because the halves sit above the content, the center is hidden until they move — the whole effect is just sliding those two covers out of the way.
Pinned, scrubbed timeline
A GSAP timeline tied to a ScrollTrigger pins the stage (pin: true) and runs for end: '+=120%' with scrub: true, so the panels' positions follow the scrollbar. From position 0, the left half tweens xPercent: -100 and the right half xPercent: 100, sliding each fully off its own edge, while the center scales up and brightens. Sharing one timeline keeps the parting symmetrical and reversible — scroll back and the curtains close.
The center settles as it's revealed
The center starts slightly scaled down and dimmed (gsap.set to scale: 0.9, opacity: 0.4) and animates to full size and opacity over the same scroll, with its heading rising from an offset. So the revealed content doesn't just appear — it eases into focus as the panels retreat, which makes the reveal feel composed rather than a hard uncover.
Why xPercent and a pin
Using xPercent (a transform) rather than left means the slide is GPU-composited and never reflows, even at full screen size. Pinning holds the stage still so the parting plays over a controlled scroll distance instead of scrolling away; end: '+=120%' gives it a little over one screen to complete, which reads as deliberate.
Linear and reversible
ease: 'none' on the panel tweens locks their travel to the scroll position so there's no rubber-banding, and because everything lives on one scrubbed timeline the entire effect runs backward perfectly when you scroll up — the panels glide back together and the center dims again.
Customizing it
Swap the panel gradients for images, change the slide direction (vertical curtains with yPercent), adjust the reveal distance via end, or put real media behind the panels. Pair it with a scroll curtain reveal, a scroll image mask, or a scroll zoom hero.
Step by step
How to Use
- 1Add the GSAP CDNsInclude gsap and ScrollTrigger from the CDN panel.
- 2Paste HTML, CSS, and JSTwo cover panels hide a center message.
- 3Scroll downThe panels slide apart like curtains.
- 4See the revealThe center settles into full focus.
- 5Scroll back upThe curtains close — motion is scrubbed.
- 6Use real mediaSwap the gradients or center for images.
Real-world uses
Common Use Cases
Got questions?
Frequently Asked Questions
The stage layers a centered content block at z-index 0 beneath two absolutely-positioned halves at z-index 2 that cover it. Each half is just over 50% wide so they meet seamlessly at rest. Because the halves sit above the content, the center stays hidden until the panels slide out of the way.
A GSAP timeline tied to a pinned ScrollTrigger with scrub: true slides the left half to xPercent -100 and the right half to xPercent 100 from position 0, moving each fully off its edge. Because it is scrubbed, the panels' positions follow the scrollbar and reverse when you scroll up, closing the curtains.
The center starts slightly scaled down and dim via gsap.set, then animates to full size and opacity across the same scroll while its heading rises from an offset. So it eases into focus as the panels retreat rather than snapping into view, which makes the reveal feel choreographed with the parting.
xPercent is a transform, so the slide is composited on the GPU and never triggers layout reflow, even at full-screen panel sizes. Animating left would reflow each frame and stutter. Pinning holds the stage so the parting plays over a controlled distance, and ease: none keeps the travel locked to scroll.
In a mount effect, register ScrollTrigger and build the pinned, scrubbed timeline scoped to refs for the stage and panels, with a gsap.set for the center's initial state. Return a cleanup that reverts the GSAP context so the pin and triggers are torn down on unmount. The layered CSS ports unchanged.