I'm using the Lightbox2 script and the content of my page is loaded via an AJAX request.
I don't find any function to attach new images or initialize Lightbox2 after an AJAX request, How can I make that in order to use Lightbox2 for images loaded via AJAX ?
Léo
I had to reinitialize lightbox in order to detect new images. I have done that like this:
window.lightbox.init();
I placed this code in my success handler of ajax call after I have added the new content:
contentContainer.empty().html(data);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With