<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/1.6.11/css/lightgallery.min.css" rel="stylesheet"> <div id="lightgallery"> <a href="img/after_effects.jpg"> <img src="img/after_effects.jpg" alt="" width="300px" height="300px"> </a> <a href="img/premiere.png"> <img src="img/premiere.png" alt="" width="300px" height="300px"> </a> <a href="img/audition.jpg"> <img src="img/audition.jpg" alt="" width="300px" height="300px"> </a> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/lg-thumbnail/1.1.0/lg-thumbnail.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/lg-fullscreen/1.0.1/lg-fullscreen.min.js"></script> <script> document.body.onload = async function () { var img = await fetch('http://165.227.172.134/api/v1/albums/1/'); var imgResponse = await img.json(); console.log(imgResponse.photos); var divLightGallery = document.getElementById('lightgallery'); for (let i = 0; i < imgResponse.photos.length; i ++) { let src = imgResponse.photos[i]; let a = document.createElement('a'); let img = document.createElement('img'); a.setAttribute('href', src); img.setAttribute('src', src); a.appendChild(img); divLightGallery.appendChild(a); } } </script> 

// Static pictures work, the gallery works, pictures that came from Bekend are not added to the gallery, when I click on the picture it goes to the place where the picture is stored. I hope I formulated my question correctly, thanks in advance =)

  • I apologize for the poorly formatted code - Dinmukhamed Azimbayev

0