The Before & After Slider (BAS) allows you to compare content side-by-side, either horizontally or vertically. This solution is built entirely using Webflow elements in the Designer, so you can fully customize it to match your preferences. The slider works by applying attributes to specific elements, making it robust, modular, and customizable.
You can implement the slider in a few different ways:

To quickly add a Before and After Slider, simply clone the project or visit Flowbase to copy-paste our prebuilt component into your project. This component has the structure, attributes and script all set up for you. All you need to do is click publish and view the live site to see your BAS in action!
The Booster app offers a user-friendly interface for adding components, customizing attributes and simplifying script installation and updates.


We’ll walk you through creating a horizontal slider similar to the one in the live preview. You’ll add the elements and attributes yourself, and the script will handle the functionality for you.
Copy and paste the script into your Project Settings, Page Settings, or an Embed Element on your page
<!-- Flowbase Booster [Before & After Slider] -->
<script src="https://cdn.jsdelivr.net/npm/@flowbase-co/boosters-before-after-slider@1/dist/before-after-slider.min.js"></script>

This will be the main container for all the slider elements, including images, the drag handle, and labels. To add this, drag a div-block to your page and add the attributes and styles as described below.
position: relativewidth: 100%max-width: 600px (adjust as needed)height: 400px (adjust as needed)fb-before-after: truefb-before-after-direction: horizontalfb-before-after-start: 50Inside the Slider Wrapper, add the images for comparison. For best results, ensure both images are exported at the same size. The Before & After image will need their own classes, as each of these elements have slightly different styles. If you're unsure of anything, make sure to check out our demos and examples linked above.

display: blockwidth: 100%height: 100%fit: cover
display: blockmargin-left: autowidth: 50%height 100%fit: coverposition: absolutefb-before-after-side = after
To add a draggable handle, click on the BAS Wrapper, and add another nested div-block. Add the required styles below, and be sure to add a transform move property with a -50% value for the X & Y fields.
width: 50pxheight: 50pxposition: absolutez-index: 2left: 50%top: 50%transform: translate(-50%, -50%)fb-before-after-handle = true
Add a line that divides your two images.
width: 2pxbackground-color: whiteposition: absolutez-index: 1left: 50%top: 0pxbottom: 0pxtransform: translate(-50%, 0)
Add labels to indicate the “Before” and “After” sides of the slider. Clicking on these will reveal the full image.
background-color: whiteposition: absoluteleft: 24pxtop: 24pxfb-before-after-label = beforebackground-color: whiteposition: absoluteright: 24pxtop: 24pxfb-before-after-label = afterPublish your site to test the slider. You should now be able to drag the After Image to reveal the Before Image.
Your support means the world to us! In just 10 seconds, you can make a big difference:
Thank you for being awesome! 🌟