Title: Binding lightbox on Infinite Scroll
Last modified: August 24, 2016

---

# Binding lightbox on Infinite Scroll

 *  Resolved [Steve D](https://wordpress.org/support/users/steadwell/)
 * (@steadwell)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/binding-lightbox-on-infinite-scroll/)
 * Bruno,
 * I resolved my previous problem with loading images on infinite scroll, using 
   your advice
 *     ```
       $("img").addClass("ls_lazyimg");
       ```
   
 * however, I’m now struggling to get the lightbox to work on subsequent posts.
 * I tried using
 *     ```
       $("a").addClass=("fancyboxsingle");
       ```
   
 * but that didn’t work. It’s not “binding” properly I would guess.
 * Any pointers you could offer would be greatly appreciated.
 * Again, thanks for the plugin!
 * [https://wordpress.org/plugins/images-lazyload-and-slideshow/](https://wordpress.org/plugins/images-lazyload-and-slideshow/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [Steve D](https://wordpress.org/support/users/steadwell/)
 * (@steadwell)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/binding-lightbox-on-infinite-scroll/#post-5974524)
 * I got it!
 * For anyone who may need this in the future:
 *     ```
       jQuery( document ).ready( function( $ ) {
            // Trigger image lazyload and reinit fancybox
            $( document.body ).on( 'post-load', function () {
               window._lazyimgs = $("img.ls_lazyimg");
               $("a[href*='uploads']").addClass("fancyboxsingle");
       	$("a.fancyboxsingle").fancybox();
            });
       });
       ```
   
 * Insert this script in a .js module and include in the header. Works for the “
   Images Lazyload and Slideshow” plugin and it’s fancybox with Jetpack Infinite
   Scroll.

Viewing 1 replies (of 1 total)

The topic ‘Binding lightbox on Infinite Scroll’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/images-lazyload-and-slideshow_6381a1.
   svg)
 * [Images Lazyload and Slideshow](https://wordpress.org/plugins/images-lazyload-and-slideshow/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/images-lazyload-and-slideshow/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/images-lazyload-and-slideshow/)
 * [Active Topics](https://wordpress.org/support/plugin/images-lazyload-and-slideshow/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/images-lazyload-and-slideshow/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/images-lazyload-and-slideshow/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Steve D](https://wordpress.org/support/users/steadwell/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/binding-lightbox-on-infinite-scroll/#post-5974524)
 * Status: resolved