Before / after slider

Compare before and after states of the same visual with a draggable divider.

Preview

A draggable boundary changes the visible share of two aligned layers for direct comparison.

Preview
Before
After

Implement Before / after slider: Compare before and after states of the same visual with a draggable divider. Use Divider position 50%, Duration 180ms. Trigger it from real pointer, touch, or keyboard interaction. Use semantic HTML, scope CSS to .motion-demo--before-after-slider, and mount the provided vanilla JavaScript interaction runtime. Provide equivalent low-motion behavior for prefers-reduced-motion and .force-reduced-motion.

Learn more