biati-digital / glightbox

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

Set Elements not work if Title or description set #525

Open doiftrue opened 3 months ago

doiftrue commented 3 months ago

Describe the bug


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

To Reproduce Steps to reproduce the behavior:

  1. Add this code:

    document.addEventListener( 'DOMContentLoaded', function(){
    
      const lb = GLightbox( {
          zoomable: true,
          selector: '',
          elements: [
              {
                  type: 'image',
                  href: 'https://picsum.photos/1200/800',
                  title: 'My Title',
                  description: 'Example',
              },
              {
                  type: 'image',
                  href: 'https://picsum.photos/1200/800',
                  title: 'My Title',
                  description: 'Example',
              }
          ]
      } )
      lb.openAt( 0 )
    
    } );
  2. It not work.
  3. Remove title and description parameters it's works fine.

Expected behavior Opened lightbox slide.

Post the code you are using Help me solve issues faster, if I can copy paste your code I can try to reproduce and fix the bug faster.

Screenshots image image image

Such ternary fix the problem: image image

Desktop:

luglio7 commented 3 months ago

same problem here

gingerchew commented 3 months ago

@doiftrue Can you create a codepen or codesandbox with a minimized test case?

rtkirill commented 3 months ago

same issue

FYI: work only if set descPosition: 'right'