Closed cs-mshah closed 1 month ago
It would also be great to have a multi sliders to show multiple layers on top of a single image. Something like depth maps, segmentation maps and normal maps beside the main RGB image.
I will take a look.
I think I messed up some css. Moreover juxtapose
seems to be quite old. I just used https://img-comparison-slider.sneas.io/:
Add this to the header:
<script defer src="https://cdn.jsdelivr.net/npm/img-comparison-slider@8/dist/index.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/img-comparison-slider@8/dist/styles.css" />
<style>
.slider-container {
text-align: center;
}
.centered-slider {
display: inline-block;
}
.before,
.after {
margin: 0;
}
.before figcaption,
.after figcaption {
background: #fff;
border: 1px solid #c0c0c0;
border-radius: 12px;
color: #2e3452;
opacity: 0.8;
padding: 12px;
position: absolute;
top: 50%;
transform: translateY(-50%);
line-height: 100%;
}
.before figcaption {
left: 12px;
}
.after figcaption {
right: 12px;
}
</style>
Add this anywhere in the code:
<div class="slider-container">
<img-comparison-slider class="centered-slider slider-with-animated-handle">
<figure slot="first" class="before">
<img src="assets/figures/mug.webp" />
<figcaption>Mug</figcaption>
</figure>
<figure slot="second" class="after">
<img src="assets/figures/mug2.webp" />
<figcaption>Mug 2</figcaption>
</figure>
</img-comparison-slider>
</div>
This also works inside the slide-content
class and is well centred now. But it would be great to have a native solution.
Hi @cs-mshah, really appreciate your provided solution above. I have slightly tuned the design based on your code and have now added it to the main template: https://github.com/lorenmt/clarity-template/commit/46ec3eee19ea86775982e3c93c5b35716bad2d09.
Can we integrate a slider as well, since several projects involve comparing with a previous method. One such project which integrates sliders like juxtapose (https://github.com/NUKnightLab/juxtapose) is BrushNet (https://tencentarc.github.io/BrushNet/). I tried to do the following as per the basic example, but there seems to some conflict with the CSS of juxtapose and clarity:
Is there any way to integrate a slider easily within clarity containers?