I have an issue whereby I’m populating a lightbox using a cms list and it works fine. However, if some cms fields aren’t populated, a blank thumbnail appears in the lightbox thumbnail list at the bottom of the screen. I’ve made a jsfiddle out of it and I’m looking to find a solution that removes lightbox thumbnail which are empty.
Hi @Diarmuid_Sexton , your piece of code works great in the chrome console but I can’t seem to make it work in my webflow project… I use the lightbox CMS workaround + conditionnal visibility on lightbox links.
Is there something to declare first ? Like to opening of the lightbox for instance ?
I tried adding document ready or window onload but apparently it runs to early…
Where did you inject this snippet for it to work ?
I haven’t done anything special. Be sure to place it in the footer - of either the page or of the entire site - as it uses Jquery and jquery is only loaded at the start of the footer.
I’ve tried inserting it after the custom code for CMS lightbox in embed and doesn’t work either…
I think I’m missing some simple thing and can’t figure out what…
In the chrome inspector console,
This $(":not(.w-lightbox-item:has(img))").remove(".w-lightbox-item");
only works when triggered with the lightbox opened. If you trigger it before opening it doesn’t remove the lightbox item like required…
Hmm… Ok, thanks anyway.
Since I’ve been trying stuff with no success for a couple of hours, I’m going for a dirty CSS workaround for now which I’ll share for those who might have the same issue as me
I could not get your jquery to work…Have you cracked it since your last post? I would be majorly keen to hear about any developments, I see you have tried and suggested a few variations of code snippets. My Js skills are non-existent so I am no help to you unfortunately and have settled for @pepperclip 's handy bit of CSS for now.
Cheers
Hi @pepperclip this just does not work for me, unfortunately. I probably have set up the lightbox pretty strangely…
I do not have an image src in the html emded code, just an empty link over background images which activates the lightbox. Perhaps this is the reason why I am struggling to locate a specific class to target for this js code snippet.