ashleydw / lightbox

A lightbox gallery plugin for Bootstrap
http://ashleydw.github.io/lightbox
MIT License
1.85k stars 1.3k forks source link

Updating data-gallery attribute with jQuery causes odd lightbox behaviour #323

Open kwoodberry101 opened 5 years ago

kwoodberry101 commented 5 years ago

Hi Ashley

I am using Bootstrap 4 with your Ekko lightbox gallery - http://ashleydw.github.io/lightbox/#image-gallery

I am filtering the images using jQuery. The filter simply shows/hides images with the matching class name.

Upon filtering I am dynamically updating the data-gallery attribute so only those filtered images are available to click through in the lightbox gallery.

Here's my development site - http://damansv2.woodberry.me.uk/gallery/ex-display/

This seems to work ok but there's a glitch which removes the abililty to page next/prev through the gallery. I assume this is because the data-gallery attribute is being changed dynamically?

To replicate the glitch, try the following:-

  1. Go to http://damansv2.woodberry.me.uk/gallery/ex-display/
  2. Click 'kitchens' filter, then click the first image and the gallery lets you correctly page forward/backwards through the 4 filtered images. Close lightbox.
  3. Click 'bathrooms' filter, then click the first image and the gallery lets you correctly page forward/backwards through the 4 filtered images. Close lightbox.
  4. Click 'all' filter, then click the first image. You are unable to page through?

Any ideas if this is a bug or what I can do to fix this?

Browser name and version Firefox Quantum 64.0.2 (64-bit) Windows 10

Many thanks in advance. Kevin :)

BjarneFred commented 4 years ago

Hi Kevin,

Did you ever find a solution to this issue? I have been pulling my hair out over the same thing.

Cheers,

Bjarne