Skip to content

lightbox.loadAndOpen(0) opens empty lightbox #2020

Answered by dimsemenov
emollini asked this question in Q&A
Discussion options

You must be logged in to vote

If you use gallery and children options, loadAndOpen doesn't know which exactly gallery to use, since there might be multiple galleries on a page. Instead you can do something like:

lightbox.loadAndOpen(0, {
  gallery: document.querySelector('.your-gallery-selector');
});

or just trigger click on the element that you wish to open

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@emollini
Comment options

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