Is there a way to prevent this from happening:

A slider with a nav carousel showing duplicate thumbnails

...without setting an explicit width on the nav slider? (Since there could be any number of slides in other sliders using the same optionset.) Thanks!

Comments

wrd-oaitsd created an issue. See original summary.

gausarts’s picture

There are a few hooks at splide.api.php, not sure which one will work, likely optionset_alter.

I haven't checked, but perhaps you will check for count variable, might be in blazies or splides, then override the optionset that decides the max amount of thumbnails to display if the amount is less than 3, etc. I forgot the exact name :)

wrd-oaitsd’s picture

So maybe:

  • Look for the "slides to show" value X
  • Count the actual number of slides Y
  • Alter the "slides to show" value to min(X, Y)

Sound reasonable?

gausarts’s picture

Perhaps the entire related options are type, perPage, perMove, and clones.

Try changing type loop to others for both main and its nav optionsets. Otherwise being out of sync.

For now just focus on type, hopefully the system takes care of the rest. If not, modify other options just as well.

Let me know how you come up?

gausarts’s picture

Perhaps the quasi-code is like this:
If optionset name == blah and count < 4, then type = slide.

Repeat for the main optionset, but might need a dedicated one to not override those not having navigations. Please clone one to avoid headaches.

If generic, you may want to add more conditions based on entity ID, field name, etc. to not override the entire site config.

wrd-oaitsd’s picture

You're right, switching it to Slide solves the problem I'm just checking for the optionset name and, if the number of slides is less than the perPage value, switching the type to Slide. Works great. There's a bit of a styling issue (the first thumbnail gets cut off when the active styles get applied), but that should be fixable in the theme. Thanks!

gausarts’s picture

Feel free to re-open if any patch to benefit others.

Thanks.

gausarts’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.