Lightgallery multiple instances not working

561 views Asked by At

I got a couple of images that I want to open a gallery with (using lightgallery). So I looked up their documentation, and found out to use multiple instances I have to include lg-hash.js and give ids to the different galleries. That is exactly what I did but the second image is not working. It opens the lightbox but the loader just keeps spinning endlessly.

My code:

<div id="hash">
    <a href="'.$fbimage.'">
        <img style="max-width:250px;" src="'.$fbimage.'">
    </a>
</div>
<div id="hash1">
    <a href="'.$block_image->{'image_intro'}.'">
        <img style="max-width:100%;" src="'.$block_image->{'image_intro'}.'">
    </a>
<div>

And the js part:

<script type="text/javascript">
$(document).ready(function() {
    $("#hash").lightGallery({
        hash: true,
        galleryId: 1
    });
    $('#hash1').lightGallery({
        hash: true,
        galleryId: 2
    });
});
</script>

The first one is working as it should, but the second image is not loading, and I can't close the lightgallery on the second one.

What is going wrong? Here is a link to their documentation

0

There are 0 answers