Disable prev/next when slides only contain one image? #250
-
i found that the prev/next keep repeating the same image since my slides only contain one image. Any way to disable this? thank you |
Beta Was this translation helpful? Give feedback.
Answered by
igordanchenko
Mar 15, 2024
Replies: 1 comment
-
Certainly. You just need to disable "infinite" carousel mode in this case: <Lightbox
carousel={{ finite: slides.length <= 1 }}
// ...
/> You can also hide navigation buttons when there is just one slide: <Lightbox
carousel={{ finite: slides.length <= 1 }}
render={{
buttonPrev: slides.length <= 1 ? () => null : undefined,
buttonNext: slides.length <= 1 ? () => null : undefined,
}}
// ...
/> This use case is covered in the documentation over here - https://yet-another-react-lightbox.com/customization#HidingNavigationButtons |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
igordanchenko
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certainly. You just need to disable "infinite" carousel mode in this case:
You can also hide navigation buttons when there is just one slide:
This use case is covered in the documentation over here - https://yet-another-react-lightbox.com/customization#HidingNavigationButtons