Skip to content

Before and after slider

Two stacked photos and a draggable handle to show your renovations, haircuts or gardens before and after.

  • Tailwind
  • React
  • CSS
  • WordPress
Open in a new tab

Description

The handle is a real range input: arrow, Home and End keys, a "Before 60 %, after 40 %" announcement for screen readers, and mouse or finger dragging anywhere on the photo. Three projects are picked with toggle buttons. Without JavaScript the photos stay split in the middle; with prefers-reduced-motion the handle moves without animation. Gradients are replaced by your photos while keeping the alternative text.

Code

Loading the code…

The code of this component in

Archive contents

galerie-avant-apres-curseur-html-tailwind.zip3 files · 6 Ko

  • index.html14 Ko
  • README.md3 Ko
  • LICENSE.md1 Ko

Tags

Updated on December 2, 2026.

Reviews

No reviews yet.

In the same spirit

  • A product photo that zooms in under the pointer, and from the keyboard with Enter and the arrow keys, to inspect the details.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Building site photos sorted by dated step on a vertical timeline, with the current step highlighted.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component