Splitview

Before and after, in one small file.

Splitview puts a comparison slider between two images. Drag it, follow the pointer, or turn it vertically. One JavaScript file, one stylesheet, no dependencies, and the handle is a real slider for keyboard and screen reader users.

Coastal scene, flat colour The same scene with a warm sunset colour grade

No dependencies

Plain JavaScript and CSS. No jQuery, no build step, no network requests.

Keyboard and screen readers

The handle is a slider with arrow keys, Home, End and Page Up / Page Down.

Drag or hover

Pointer drag for a hero, hover follow for a gallery, vertical for tall images.

Works anywhere

Static HTML, WordPress, Shopify, Webflow, React, Vue. It is one element and two images.

Three ways to use it

Each card below is a real instance of the plugin, configured with data attributes only.

Daylight version Sunset grade
Drag. The default. Works with mouse, touch and pen.
Daylight version Night version
Vertical. For tall images and full-height sections.
Night version Sunset grade
Hover. Follows the pointer, returns when it leaves.
Sunset grade Daylight version
Auto animate. Sweeps into place once, when it scrolls into view.

Builder

Change the options, watch the preview, then copy the snippet. The snippet is exactly what the plugin needs on a page.


          

Options

What you get

In the download

  • splitview.js and splitview.css, unminified and commented
  • This demo page, which is also the builder
  • Documentation: every option, the API, events, accessibility
  • An honest limits section, so you know what it does not do

Good fit for

  • Photo retouching and colour grade portfolios
  • Renovation, restoration and product upgrade pages
  • Day and night, or old and new, in one frame
  • Any page where two images tell the story better than one