Skip to content

Is there a way to show less thumbnails when less than 5 slides? #21

Answered by igordanchenko
ARChilton asked this question in Q&A
Discussion options

You must be logged in to vote

The Thumbnails plugin uses carousel.preload prop when determining how many thumbnails to show. So, in this case, you could set carousel.preload to 1.

<Lightbox
  open
  slides={slides}
  plugins={[Thumbnails]}
  carousel={{ preload: Math.min(Math.floor(slides.length / 2), 2) }}
/>

https://codesandbox.io/s/yet-another-react-lightbox-21-rjo2qd?file=/src/App.js

However, you'd still see repeating thumbnails when you have an even number of photos.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@davidburson
Comment options

@igordanchenko
Comment options

Answer selected by igordanchenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants