0

I'm outputting three thumbnails with data-slide attributes on the page and use dynamic mode to populate the gallery with more images. It works fine, however when I open the gallery by clicking on the second/third thumbnail and press the next arrow, the gallery goes to the first slide instead of the next.

Demo code can be found here: https://jsfiddle.net/ebatron/56rpLaby/4/

elbatron
  • 675
  • 3
  • 16
  • 30

1 Answers1

1

It turns out that the index property requires a number and I was passing a string instead:

var slideID = $(this).attr('data-slide');
$(this).lightGallery({
dynamic: true,
index: parseInt(slideID, 10),
dynamicEl: album
});

Working fiddle: https://jsfiddle.net/56rpLaby/5/

elbatron
  • 675
  • 3
  • 16
  • 30