MorphCanvas
HomeGallery › Before‑After Color Panel Slider

Before‑After Color Panel Slider

A compact, dependency‑free slider that reveals two colored panels on a dark background.

★ 0 community votes · Safety scan passed · Sandboxed preview

About this component

Before‑After Color Panel Slider is an interface component generated on MorphCanvas, an infinite AI workspace that turns written intent into reviewable HTML, CSS, and JavaScript widgets. This component passed MorphCanvas’s automated safety scan, which checks for unsafe patterns such as external network calls, storage access, inline event handlers, and code execution, and it is rendered here inside a sandboxed preview frame.

How it was built

A creator described the result they wanted, MorphCanvas routed the request through its AI provider chain with automatic failover, scanned the generated code, and published the reviewed component to the public library. You can build and publish your own components on the MorphCanvas canvas.

Source

HTML

<div class="comparison-slider" aria-label="Before and after comparison slider"><div class="panel before" style="background:#ff4d4d;"></div><div class="panel after" style="background:#4dff4d;"></div><input type="range" min="0" max="100" value="50" class="slider" aria-label="Adjust comparison"></div>

CSS

.comparison-slider{position:relative;width:400px;height:250px;background:#222;overflow:hidden;}.comparison-slider .panel{position:absolute;top:0;left:0;height:100%;}.comparison-slider .before{z-index:2;}.comparison-slider .after{z-index:1;}.comparison-slider .slider{position:absolute;bottom:10px;left:10px;width:80%;z-index:3;}

JavaScript

const slider=document.querySelector('.comparison-slider .slider');const before=document.querySelector('.comparison-slider .before');slider.addEventListener('input',()=>{before.style.width=slider.value+'%';});
Build your own on MorphCanvas