CMS LIghtbox - Remove Empty Thumbnails

Hi Webflowers,

I have successfully implemented a dynamic Lightbox gallery using custom code.https://preview.webflow.com/preview/volatiles-staging?preview=534eaa3edcd95d48780a1a4643c2601d

You can see on the showcase collection pages when you open the Lightbox there’s empty squares in the areas that don’t have images. Is there any way to hide these empty thumbnails if not in use using javascript?! It bugs out with a loading wheel if you click the LR arrows.

Many Thanks

Did you try this ?

$(".lightbox-link").each(function(){    
      if ($(this).find(".lightbox-image").attr("src") === "")         
        $(this).remove(); 
 });

From here : Full CMS Lightbox! - #111 by Siton_Systems