Update jquery plugin trigger when updating image via DOM

Asked

Viewed 25 times

0

I made a gallery in HTML5 and CSS3 and inserted a plugin Jquery "Lightgallery" to open the images in larger size as lightbox, there is a large image and several thumbnails, when I click on a thumbnail the larger one is replaced by the large image of thumbnail, but the loaded plugin does not recognize the new image inside the attribute, it has some way to update the plugin trigger so that it recognizes the new image path that has been updated?

<html>
<body>

<img id="imgDestaqueShow" data-src="caminho-da-imagem/grande1.jpg" src="caminho-da-imagem/pequena1.jpg" class="light-link">

<img data-src="caminho-da-imagem/grande2.jpg" src="caminho-da-imagem/pequena2.jpg" class="thumbnail-gallery">

<img data-src="caminho-da-imagem/grande3.jpg" src="caminho-da-imagem/pequena3.jpg" class="thumbnail-gallery">

<script>
$(document).ready(function(){

$("#lightgallery").lightGallery({
    selector: '.light-link'
});

$(".thumbnail-gallery").on('click', function(){
    var transferImg = $(this).attr('data-src');
    $("#imgDestaqueShow").attr('src',transferImg);
    $("#imgDestaqueShow").attr('data-src',transferImg);
});

});
</script>

</body>
</html>
  • Have you put the full code to try to reproduce?

  • Please post the full code (All folders and libraries) so we can see your problem and help you.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.