davidjerleke / embla-carousel

A lightweight carousel library with fluid motion and great swipe precision.
https://www.embla-carousel.com
MIT License
5.39k stars 166 forks source link

Responsive slides #653

Closed ccanete closed 6 months ago

ccanete commented 6 months ago

Feature request is related to

Is your feature request related to an issue?

I'd like to display some slide only on mobile or desktop

Describe the solution you'd like

I have been trying to show / hide slides using CSS (display: none) but it seems to impact the slider and I end up between two slides when sliding between slides. The CSS option might not be the best one or might require some additional thoughts / guidance.

davidjerleke commented 6 months ago

Hi @ccanete,

Use the slides option together with breakpoints and make sure the slides you want to hide don’t take up any space. For example you can hide them with display: none; as you mentioned.

A friendly reminder: Please always create a new discussion instead of an issue if you don’t know how to achieve something.

Best, David

ccanete commented 6 months ago

Thanks a lot @davidjerleke for the prompt answer and sorry for the wrong channel. I'll go for discussions next time.

And great job with Embla, it's fantastic to use.