Gallery · Before and after
Two photos on top of each other and a line you drag, or that follows the mouse, to compare them. Side by side or top and bottom.
![]()
See it live: Gallery · Before and after on fancybricks.co — the live preview, and the button that copies it.
Or open the preview on its own — narrow the window to see it on a phone — and in dark mode.
Preview on the front end. Scripts don't run inside the builder, so here you only see the layout: the line doesn't move here (the script runs on the front end). Save and open the page to see the full result.
Structure
This is what the Bricks Structure panel shows after you paste the template. Component instances say which component they are.
Image compare
Container
Intro (FBK Intro)
Two directions
Compare · Side by side (FBK Compare)
Compare · Top and bottom (FBK Compare)
Compare · Follows the mouse (FBK Compare)
The template also pastes a dashed note above the section, with the short version of this page. It only shows inside the builder, never on the published page — see Builder notes.
FBK Compare
This template is built on its own component, FBK Compare: select it in the Structure panel and everything below is in its Properties.
Before and after: two photos and a line you drag (or that follows the mouse) to compare them. Keyboard arrows move it too. Needs "Execute code".

FBK Compare in the Bricks panel: its own properties are at the top.
- Before photo: Same size and framing as the after photo.
- Before alt text: What the before photo shows.
- After photo: Same size and framing as the before photo.
- After alt text: What the after photo shows.
Tags
- Before tag: The label over the before photo.
- After tag: The label over the after photo.
- Hide tags: Hides both the Before and After labels.
Style
- Direction: Side by side drags the line left and right; Top and bottom drags it up and down. Options: Side by side · Top and bottom.
- Move: Follow the mouse: the line follows the pointer (touch screens and keyboard still drag). Options: Drag · Follow the mouse.
- Proportion: The crop shape of both photos: Auto keeps their own, or pick a fixed ratio. Options: Auto · 16:9 · 4:3 · 1:1.
Handle
- Handle icon: The icon on the round handle (it turns with the line when the direction is top and bottom).
- Icon effect: Under the mouse, while dragging and with keyboard focus. Options: None · Sway · Spin · Grow.
- Hint: A ring leaves the handle three times when the photo comes into view, to show it moves. Options: Off · On.
How to adjust
Every step is the same move: pick the element in the Structure panel, change its Properties.
How to adjust a template shows every one of them in a screenshot of the real builder: the Structure and Properties panels, the classes on an element, a component's style families and the field where a CSS variable goes.

The classes this element carries, in the Bricks panel.

This template's own component, with its Style group open.
- Paste the template in Bricks first — see Copy and paste.
- Select Intro (FBK Intro) › Properties: Eyebrow, Hide eyebrow, Title, Title level, Lead, Hide lead · Style group: Eyebrow style, Highlight, Title size, Accent line · Layout group: Alignment, Layout, Background, Spacing · Motion group: Reveal in slider.
- Select Compare · Side by side, Compare · Top and bottom, Compare · Follows the mouse (FBK Compare) › Properties: Before photo, Before alt text, After photo, After alt text · Tags group: Before tag, After tag, Hide tags · Style group: Direction, Move, Proportion · Handle group: Handle icon, Icon effect, Hint.
Requirements
- Code execution. Needs "Execute code" enabled for the role in Bricks → Settings → Custom code, or the JS block shows as plain text instead of running.
What each requirement is, and how to set it up once for the whole site: Requirements.
Finish by hand
- Replace both photos in the FBK Compare properties (same size and framing) and write what each shows in its alt text. Direction (side by side or top and bottom), move mode, proportion, the tags, the handle icon and its effect (Sway, Spin, Grow) are in its properties. The demo shows both directions and, below, the move mode Follow the mouse (touch screens and the keyboard still drag); delete the ones you don't need.
- Needs "Execute code"; without it the photos show half and half. Line color:
--fbk-imgcmp-lineon.fbk-imgcmp. - Hint: a ring leaves the handle and its arrows sway, three times, when the photo comes
into view (property Hint, class
fbk-imgcmp--hint; the ring is ::after of.fbk-imgcmp__knob). Set it to Off for a still handle.
On phones
The template is designed desktop first, the Bricks default, and only changes at the two widths the library uses:
- 991px and below —
.fbk-intro. - 767px and below —
.fbk-section.
Those changes live in Bricks' own breakpoint fields, so you edit them where you always do: pick the breakpoint in the toolbar and the same fields follow.
Careful with the classes shared by the whole library (fbk-section, fbk-intro, the
component classes): a change there shows up in every template that uses them.
If your site's breakpoints are set up mobile first, copy the mobile-first variant of the template instead — see Copy and paste.
Accessibility
In this template, keyboard focus is visible on every interactive piece; movement is cut back
when the visitor's system asks for less motion; the state screen readers need is already set
(aria-hidden).
What is checked on every template, and what depends on your own palette: Accessibility.
Dark mode
With your site in dark mode this section turns dark too — the class fbk-section--auto-dark
on the section does it. Remove the class to keep it light.
Its background is a modifier on the section, so you can swap it for any of the ones the
template is checked with: fbk-section--light, fbk-section--soft, fbk-section--dark.
How the library follows your site's color scheme: Dark mode and preview.
Replaces
- 01 - Image comparison from Fancy Bricks 1.0
- 02 - Image comparison (free) from Fancy Bricks 1.0
- 03 - Image comparison from Fancy Bricks 1.0
- 04 - Image comparison (Vertical) from Fancy Bricks 1.0
- 01 - Image comparison from Fancy Bricks 2.0
What happened to the old libraries, and what to do with pages already built with them: Migrating from 1.0/2.0.