Jump to content

Hide caption photo credits in Lightbox popup

Recommended Posts

Posted
On 2/9/2022 at 6:00 AM, bholm said:

Site URL: https://www.brookeholm.com/work/architecture

Hey there,

Trying to hide the photo captions from the masonry grid of images on this page - but would like them to show up once the lightbox opens upon clicking an image. Any way to accomplish this? Can't find any options on the settings.

Thank you!

1. Home > Settings > Advanced > Code injection, choose footer

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $('.gallery-lightbox-item-img').each(function(){
    var alt = $(this).find('img').attr('alt');
    $(this).append('<div class="lightbox-caption">' + alt + '</div>');
    });
});
</script>

2. Home > Design > Custom Css

figcaption.gallery-caption {
  display:none;
}
.lightbox-caption {
  position:absolute;
  bottom:0;
  color:white;
  text-align:center;
  width:100%;
}

Let me know how it works on your site

Support me by pressing 👍 if this useful for you

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted

Thank you so much this seems to work well!

Wondering if there is a way to move it off the image though, to just underneath?

 

Posted
On 2/15/2022 at 12:33 AM, bholm said:

Thank you so much this seems to work well!

Wondering if there is a way to move it off the image though, to just underneath?

 

Don't remove any code

Add this to Design > Custom CSS

.lightbox-caption {
    bottom: -20px;
    z-index: 999999;
}
.gallery-lightbox-item-src {
    overflow: visible;
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted

Thank you so much this works much better! The text disappears on phone version, which is not a big deal, but is that normal? Thanks!

Posted
On 2/26/2022 at 1:23 AM, bholm said:

Thank you so much this works much better! The text disappears on phone version, which is not a big deal, but is that normal? Thanks!

Add this to Design > Custom CSS

/* lightbox disappear on mobile */
@media screen and (max-width:767px) {
.lightbox-caption {
    bottom: 20% !important;
}
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.