Slide Over
A solid panel sweeps across the screen from left to right, covers the old page, the new one settles underneath, and it exits on the right: 1 s, the content never moves, only the panel sweeps — and on the way back it runs from right to left. CSS transform + 1.6 KB of JavaScript.
Updated
This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Transitions has 52 effects, including 9 free. Explore the category →
3 usage examples



How it works
The .slide-over-overlay panel is the third layer of the .transition-preview screen, set at z-index: 10 over the old page and the new one: a cyan to green gradient as large as the screen, parked off-screen on the left by transform: translateX(-100%), letting clicks through.
On click, the panel gets .animating and plays @keyframes slideOver over 1 s ease-in-out: translateX(-100%) → 0 at 45%, still until 55%, then 100%. It covers the whole screen from 0.45 s to 0.55 s; at 0.5 s the script toggles the .is-b class on .transition-preview, which swaps the pages underneath. The panel animates transform only: no layout recalculation, and the text of A and B stays still, which sets this wipe apart from a slider where the content itself moves. On the next click, the script also sets .is-back, which switches the animation to animation-direction: reverse: the panel enters from the right and leaves on the left (measured 200 ms into the return: +532 px in Chromium 151, +506 px in Firefox 153, so on the right side).
After the sweep, B stays in place: .is-b no longer moves until the next click, which sends the panel the other way to return to A (checked with Chromium, Firefox and WebKit: B holds with no time limit, A comes back on the second click).
Accessibility
- Reduced motion: the panel no longer sweeps when
prefers-reduced-motion: reduceis on; the script sets.is-bon the spot and a 150 ms CSS fade does the swap (measured: no moving panel, B readable within 250 ms). - Keyboard and screen readers: the same trigger as Fade Through (fx-0685), a real button that stays focused during the sweep; the hidden page is not read. To announce B on arrival, put
aria-live="polite"on the screen.
Browser compatibility
CSS (@keyframes on transform, animation-direction, inset) + 1.6 KB of JavaScript, no dependency. Measured in Chromium 151, Firefox 153 and WebKit 26.5: panel at translateX(0) at swap time, page B held, back to A on the next click with the panel reversed, focus kept, direct swap under reduced motion. inset sets the minimum versions: Chrome 87, Firefox 66, Safari 14.1.
Without JavaScript, page A stays on screen and the button does nothing: provide a regular link to the next page. Without inset (Safari before 14.1), write top: 0; right: 0; bottom: 0; left: 0 on .transition-content and .transition-overlay.
The code
HTML structure to paste into your page (the CSS + JS come with your purchase):
<div class="so-stage">
<div class="transition-preview">
<div class="transition-content old-content">Page A</div>
<div class="transition-content new-content">Page B</div>
<div class="transition-overlay slide-over-overlay"></div>
</div>
<button type="button" class="trigger-btn">Trigger Transition</button>
</div>
One-time payment, no subscription — the code is yours forever
Customize
Options passed to the API or data-* attributes:
| Option / property | Default | Effect |
|---|---|---|
Panel color (CSS — .slide-over-overlay { background }) |
#0e7490 → #047857 gradient, like page B | A brand color turns the wipe into a signature; page B's background color makes it look as if B slides in. Stay opaque: a translucent panel would reveal the swap. |
Duration (CSS — animation: … 1s; JS — SWAP_AT, END_AT) |
1 s; swap at 500 ms, end at 1,000 ms | Change all three together, SWAP_AT at half. Under 0.6 s the panel covers the screen only for an instant: keep the 45% to 55% pause. |
Direction (CSS — @keyframes slideOver steps) |
left to right, back from right to left | For a vertical sweep, replace translateX with translateY in the three steps and in the resting rule. .is-back still reverses the direction on the way back. |
Pause on the covered screen (CSS — 45% and 55% steps) |
0.1 s | 40% / 60% keeps the panel centered for 0.2 s, long enough to show a logo or a chapter title on it. |
Content (HTML — .old-content, .new-content) |
"Page A" and "Page B" on two gradients | Any HTML. For more than two pages, fill the hidden layer before the click: the panel hides the swap. |
FAQ
stage.querySelector('.trigger-btn').click() from your listener, for instance on keydown for the right arrow: the script handles the animation, the swap and the wait. The button can be visually hidden, but keep it in the page..is-back when the click starts from page B; the .slide-over-overlay.animating.is-back rule switches the animation to reverse. Remove that rule if you always want the same direction.