• Resolved Steve D

    (@steadwell)


    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://www.ads-software.com/plugins/images-lazyload-and-slideshow/

Viewing 1 replies (of 1 total)
  • Thread Starter Steve D

    (@steadwell)

    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.