Jump to content

Put text on top of image in Gallery Stack

Recommended Posts

Hello,

I'm currently working on a gallery stack for a website (https://www.juliamacchi.com/proyectos-a/project-two-llrgk-ppmcw). I want to achieve the same style as this gallery ( https://www.juliamacchi.com/proyectos-a). Specifically, I want the title and description to appear on top of each image within the gallery stack. I'd like the text to be aligned at the bottom left of each image and to have a dark overlay on the image to ensure readability.

I've attempted to modify the gallery stack using custom CSS, but I haven't been successful in achieving the desired outcome.

Could someone please assist me with this?

Thank you!

Link to comment
  • Replies 1
  • Views 1k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Add this code to Website > Website Tools > Code Injection > Footer (DO NOT add to Custom CSS)

<!-- Gallery Block - Stack - by @phuong - tpkl -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
    $('.sqs-gallery').children('.image-wrapper').each(function(index) {
        var newVideoWrapper = $('<div class="newVideoWrapper"></div>');
        $(this).next('.meta').appendTo(newVideoWrapper);
        $(this).appendTo(newVideoWrapper);
        $('.sqs-gallery').append(newVideoWrapper);
    });
});
</script>
<style>
  .newVideoWrapper {
    position: relative;
    margin-bottom: 40px;
}

.newVideoWrapper .meta {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: rgba(255,255,255,0.5);
    width: 100%;
}

.newVideoWrapper .meta .meta-inside {
    margin: 0 !important;
    padding-left: 10px;
    padding-bottom: 20px;
}
</style>

Result

image.thumb.png.6e7d29361c8edec79fcbca65b685725b.png

 

Edited by tuanphan

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!)

Link to comment

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.