Before and After Image Comparison Slider

3 min read Updated

An image comparison slider puts two images on top of each other and lets visitors drag a handle to compare them: before and after a renovation, a photo edit, a cleaning job or a makeover. Image Hover Effects Ultimate has 4 Comparison layouts with 10 ready designs; layouts 1 and 2 are free.

The 4 Image Comparison Slider Layouts

Image comparison slider layouts 1 and 2 in the template library
  • Comparison 1 (free): the classic slider with a round handle. Each item can run sideways or up and down, and can move with a click or by simply pointing.
  • Comparison 2 (free): a slider with arrow handles and Before and After labels on the images.
  • Comparison 3 (Pro): several images side by side in strips; pointing at a strip opens it wide. Each item is one image.
  • Comparison 4 (Pro): the first image shows at rest, and moving the mouse over it reveals the second image in slices.
Comparison 3 with one image strip opened on hover, and Comparison 4 below

Try them on the Image Comparison demo page.

Create an Image Comparison Slider

  1. Go to Image Hover and click Templates on the Image Comparison card.
  2. Pick a layout and design, click Use this design, type a name and click Create and edit.
  3. On the Content tab, under Add New Comparison, click Open Comparison Form to add a slider.
The image comparison slider editor with the slider in the live preview

The Comparison Form

In Comparison 1 the form has:

  • Before Image and After Image: two tabs, each with an image from the Media Library or a Custom URL.
  • Coparison Offset (spelled this way in the form): where the handle starts, from 0 to 1. 0.5 is the middle.
  • Click To Move: with True, a click anywhere on the image moves the handle there.
  • Position: Horizontal (drag sideways) or Vertical (drag up and down).
  • Hover To Move: with True, the handle follows the mouse without dragging.
The image comparison slider form with Before Image, After Image, offset, Click To Move, Position and Hover To Move

The other layouts ask for less: Comparison 2 for the two images and the offset, Comparison 3 for one image per strip, and Comparison 4 for the two images.

Style Settings

Comparison styles have two tabs, Content and Advanced. The Content tab holds the style settings: General Style (Column Size per device, border, corners, shadow and margin), Image Settings (image position and an optional custom width) and, depending on the layout, the handle color and the look of the Before and After labels. The Advanced tab has Custom CSS.

Tips

  • Use two images with exactly the same size and framing, taken from the same spot. Otherwise the handle shows a jump instead of a change.
  • Crop both images the same way before you upload them; a free tool like Squoosh can resize and compress them.
  • Turn on Hover To Move when visitors may not know they can drag; the handle then moves on its own as they point.
  • On phones, visitors drag the handle with a finger.

Related guides: Creating Your First Hover Effect, Image Hover Effects Shortcode, Free vs Pro, Lightbox Gallery Effects, Hover Effects Not Working.

Still stuck?

A developer who works on Image Hover Effects answers every ticket.

Open a ticket