Multiple Gallery with LightGallery

0

I'm using the LightGallery plugin, on the page I have several galleries, I'm only displaying one image from each gallery, to that when clicking on this image it will open its respective gallery.

<img src="assets/images/lisboa/1.jpg" id="galeria_1" galeria_id="galeria_1">

    $(document).ready(function() {
        $('#galeria_1').on('click', function(){

            var galeria_id = $(this).attr("galeria_id");

            $("#"+galeria_id).lightGallery({
                download: false,
                counter: false,
                hash: true,
                galleryId: galeria_id
            });
        });
    });

There is simply nothing wrong with the console.

    
asked by anonymous 16.03.2018 / 15:49

1 answer

0

Solved

<img src="assets/images/lisboa/1.jpg" class="galeria galeria_bt" galeria_id="galeria_1">

<div id="galeria_1" class="galeria" style="display:none">
    <div class="item1" data-src="assets/images/lisboa/2.jpg" data-sub-html="">
        <img class="" src="assets/images/lisboa/2.jpg">
    </div>
    <div class="" data-src="assets/images/lisboa/3.jpg" data-sub-html="">
        <img class="" src="assets/images/lisboa/3.jpg">
    </div>
</div>


$(document).ready(function()
{
    $(".galeria").lightGallery({
        download: false,
        thumbnail:true
    });

    $('.galeria_bt').on('click', function(){
        var galeria_id = $(this).attr("galeria_id");
        $("#"+galeria_id+" div:first-child").trigger('click');
    });
});
    
16.03.2018 / 22:04