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

Remove .gslide-description from slideHTML #456

Closed OlivierBlomme closed 8 months ago

OlivierBlomme commented 8 months ago

I am trying to hide the slide description by omitting .gslide-description html in slideHTML.

This is my code:

    let customSlideHTML = `<div class="gslide">
    <div class="gslide-inner-content">
        <div class="ginner-container">
            <div class="gslide-media">
            </div>

            <div class="gslide-description">  //Remove this block
                <div class="gdesc-inner" style="display:none;">
                    <h4 class="gslide-title"></h4>
                    <div class="gslide-desc"></div>
                </div>
            </div>  //End remove this block

        </div>
    </div>
</div>`;

    const lightbox = GLightbox({
      slideHTML: customSlideHTML,
    });

But it errors with: Uncaught TypeError: Cannot read properties of null (reading 'parentNode') and doesn't load the slide.

Expected behaviour would be showing the slide without a title/description.

I am using version 3.2.0

gingerchew commented 8 months ago

Does hiding it with a display: none; not work? Custom HTML is an advanced feature and should be a last resort.

OlivierBlomme commented 8 months ago

display: none; does work. I couldn't find any option that disables the title/descripion, so i figured using custom HTML would be the recommended way. Thank you for letting me know it isn't.