Image comparison slider
Portuguese name: Antes e depois
An image comparison slider that puts two images side by side behind a divider. Drag it with the mouse or a finger, or use the arrow keys, to compare before and after.

When to use it
Made for anyone selling a visible result: aesthetics clinics, dentists, renovations, upholstery cleaning, photo retouching. Both images need the same framing and size, or the divider exposes a crooked seam and the comparison falls flat. Use data-inicio to open the divider toward the after side when that is the selling point, and fill in data-rotulo for screen reader users.
How to add it to your site
- Copy the prompt in the gallery. It comes with the effect's name and the full code. The prompt text is written in Portuguese, and AI builders handle that fine.
- Paste it into your AI: Lovable, Claude, Cursor, Bolt or v0.
- Done: the AI adds the effect to your project, just like you saw it here.
Use it in HTML
The effect is plain JavaScript, no library. Just put the data-efeito attribute on the element:
<div data-efeito="antes-depois"><img src="antes.jpg" alt="Antes"><img src="depois.jpg" alt="Depois"></div>
More images effects
- Filterable galleryFLIP grid
- Mouse parallaxdepth layers / 2.5D image
- Halftone imagedot matrix photo reveal
- Liquid image distortionWebGL hover ripple
- Pixel revealImagem que se forma em pixels
- Ken Burns slideshow with captionsphoto story
- Image lensmagnifier
- Tile revealmosaic image reveal