biati-digital / glightbox

Pure Javascript lightbox with mobile support. It can handle images, videos with autoplay, inline content and iframes
MIT License
2.01k stars 226 forks source link

First image of config object won't appear when >= 769px but gallery acts normal if <769px #483

Closed larsactionhero closed 2 weeks ago

larsactionhero commented 4 months ago

Describe the bug I've run into this while using a link trigger to open a glightbox. If screen size is >= 769px: first image of elements object won't show up. If screen size is < 769px: gallery works as expected.

But when 1st item in config object does not contain the following entries...

'type': 'image',
'title': 'Another title',
'alt': 'image alt text'

...gallery works as expected, regardless of screen size (see example #2 in codepen)

Are you able to reproduce the bug in the demo site No.

To Reproduce Steps to reproduce the behavior: 1) this following codepen example uses the basic setup from the docs. in this example, the gallery elements are defined by the 'elements' object. https://codepen.io/larsactionhero/pen/MWRXpYb

  1. resize screen to >= 769px. first image won't show up.
  2. resize screen to < 769px. first image will show up and gallery works as expected.

Expected behavior It should open the 1st image right away.

Post the code you are using https://codepen.io/larsactionhero/pen/MWRXpYb

Screenshots Additional screenshot of my console error (taken from my current project where it appeared)

Bildschirmfoto 2024-04-11 um 18 05 33

Desktop:

gingerchew commented 4 months ago

That is odd. If you use the last release from Github (3.2.0) the issue goes away.

larsactionhero commented 4 months ago

That is odd. If you use the last release from Github (3.2.0) the issue goes away.

Thanks for your reply. But shown codepen example already uses v3.3.0.