Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

85
Vistas
AJAX compatibility with lightGallery

I am using lightGallery (1.4.0) to display images. Images come in JSON format with Ajax requests. But when I click on the images I can't view them with lightGallery. Can you tell me where am I missing something?

Settings:

var gallery = function () {
        var gallery = document.querySelectorAll('.gallery');
        if (gallery.length) {
            for (var i = 0; i < gallery.length; i++) {
                lightGallery(gallery[i], {
                    selector: '.gallery-item',
                    download: false,
                    animateThumb: false,
                    videojs: true,
                    youtubePlayerParams: {
                        modestbranding: 1,
                        showinfo: 0,
                        rel: 0
                    },
                    vimeoPlayerParams: {
                        byline: 0,
                        portrait: 0,
                        color: '766df4'
                    }
                });
            }
        }
    }();

DIVs generated with ajax result:

if (itemData.item.phl) {
    for (let phlX = 0; phlX < itemData.item.phl.length; phlX++) {
        document.getElementById('item_photos_larges').innerHTML += '<div class="col-sm-6 mb-grid-gutter"><a class="gallery-item rounded-1" href="' + itemData.item.phl[phlX].url + '"><img alt="' + translate_photo + ' ' + [phlX] + '" src="' + itemData.item.phl[phlX].url + '"></a></div>';
    }
}

Thank you.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda