Jump to content

LorenAK

Member
  • Posts

    12
  • Joined

  • Last visited

Posts posted by LorenAK

  1. I'm trying to style the captions for a client site. I used code injection to have captions show in lightbox only. I want to have a line break for image description under the title and date. Just found out line breaks aren't supported in captions. Is there a workaround?

    This is my caption setup:

    <span class="artworktitle">Stellar Stories</span>, 2021<br>
    painted photo collage, 36 x 43 inches

    So far the line break and span aren't working.

    This is the code injection:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
    <script>
    jQuery(document).ready(function($){
        $('.gallery-lightbox-list .gallery-lightbox-item').each(function(){
            var text = $(this).find('img').attr("alt");
            console.log(text);
            $(this).append('<div class="tlightbox-caption">' + text + '</div>');
        })
    })
    </script>
    <style>
    .tlightbox-caption {
        color: black;
        font-weight: normal;
        margin: 15px 0;
        text-align: center;
        display: none;
        position: absolute;
        bottom: -65px;
        z-index: 9999;
    }
    .gallery-lightbox-wrapper:hover {
    	cursor: pointer;
    }
    .gallery-lightbox-item[data-in='false'] .tlightbox-caption {
    	display: none!important;
    }
    .gallery-lightbox-item[data-active='true']:hover .tlightbox-caption{
    	display: inline-block;
    }
    .gallery-lightbox-wrapper:hover .gallery-lightbox-item[data-active='true'] .tlightbox-caption{
    	display: inline-block;
    }
    </style>

    Thanks for any help!

  2. I'm building a site for a client (on their own Squarespace account). I added some CSS and code injection to get image captions to show in the lightbox instead of on the gallery layout, etc. It was working well, but now none of my code or CSS seems to work.

    We did just hook her site up to a new domain name. Could that break the code? I wouldn't think so.

    Hard to show this because she wants her site set to private. Anyone else have a similar issue with their custom code? Thanks!

×
×
  • 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.