ismail9k / vue3-carousel

Vue 3 carousel component
https://ismail9k.github.io/vue3-carousel/
MIT License
654 stars 162 forks source link

A way to obscure off screen slides #359

Closed jrdufour07 closed 4 months ago

jrdufour07 commented 4 months ago

Is there a way to provide alternative slides when they are partially obscured in the carousel? I am displaying a list of images, I want the ones at either end to only show about 25% but be just a grey box instead of the actual image.

I've tried using the callbacks and dynamically adding classes to the slides I can determine are partial, but it's messy and the carousel rendering takes off the classes I add all the time. The best solution I've come up with is to add a gradient to the carousel container and elevate the nav buttons over top. I can then hide the gradients on the corresponding side when the user hits the beginning/end of the carousel like I'm doing with the nav buttons. The main issue with that is the gradient is over the whole carousel and I just want to change the content of the partial slides, maybe be able to animate the images fading in/out slightly.

The main reason I want to accomplish this is the images can be any colour and I want to ensure the user can see the nav controls regardless of what colour the image is. In the attached image, I want to be able to change the content of the trailing card to a medium grey box or maybe throw a grey gradient over the card only.

Screenshot 2023-12-21 at 11 54 28 AM