Jump to content

Seeking CSS (Custom code) for image gallery; Upon cursor hover overlay have description appear ~ Thank YOU!!

Go to solution Solved by tuanphan,

Recommended Posts

Hi there,

I am seeking out some code for an image gallery section I have on my homepage.  I would like to have the description of the image appear as a hover overlay when the cursor is put on it.  Currently the only option is to have the text live below the image.

 

I have attached a screenshot of what it currently looks like for context.

 

Thank you so much for the help in advance! 

 

Katie

Screen Shot 2024-08-12 at 3.57.58 PM.png

Edited by bykatieboyle
Link to comment
  • bykatieboyle changed the title to Seeking CSS (Custom code) for image gallery; Upon cursor hover overlay have description appear ~ Thank YOU!!
  • Solution

This is possible with some lines of CSS. Can you share link to page in screenshot?

Or you can also try adding this to Website Tools > Custom CSS

figure[class*="gallery"]:not(.gallery-slideshow-item) {
    position: relative;
}
.gallery-caption {
    position: static;
}
/* title */
.gallery-caption p.gallery-caption-content {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 7%;
    transition: opacity ease 200ms !important;
    opacity: 0 !important;
pointer-events: none;
}
figure[class*="gallery"]:hover .gallery-caption-wrapper p.gallery-caption-content {
    opacity: 1 !important;
}
/* overlay */
div[class*="-item-wrapper"]:after {
    background: #f4f6ea; /* overlay color */
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity ease 200ms !important;
}
figure[class*="gallery"]:hover div[class*="-item-wrapper"]:after {
    opacity: 0.75;
}
/* remove gap */
figcaption {
    padding: 0 !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!)

Link to comment

@tuanphan thank you so much for the assistance and the code!!

 

This gave me what I was trying to achieve!! However, where in this code can I change the color of the text on the hover? That's the only edit I'd like to make with this 🙂

 

You can view the edits live on my homepage at www.bykatieboyle.com

Link to comment
On 8/16/2024 at 5:19 AM, bykatieboyle said:

@tuanphan thank you so much for the assistance and the code!!

 

This gave me what I was trying to achieve!! However, where in this code can I change the color of the text on the hover? That's the only edit I'd like to make with this 🙂

 

You can view the edits live on my homepage at www.bykatieboyle.com

Change this line

/* title */
.gallery-caption p.gallery-caption-content {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 7%;
    transition: opacity ease 200ms !important;
    opacity: 0 !important;
pointer-events: none;
}

to this

/* title */
.gallery-caption p.gallery-caption-content {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 7%;
    transition: opacity ease 200ms !important;
    opacity: 0 !important;
pointer-events: none;
color: #f1f !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!)

Link to comment
  • 1 month later...

Hi @tuanphan !

 

I am so sorry I somehow missed this response to the code update.  Thank YOU so much!  I however, just noticed, that for some reason the link no longer works with this image gallery.  I have all the images displayed on my homepage hyperlinked to its case study.  Do you have any insight as to how I can reconcile this?

www.bykatieboyle.com

Thank you again!! I truly appreciate it.

Link to comment
On 9/24/2024 at 11:01 PM, bykatieboyle said:

Hi @tuanphan !

 

I am so sorry I somehow missed this response to the code update.  Thank YOU so much!  I however, just noticed, that for some reason the link no longer works with this image gallery.  I have all the images displayed on my homepage hyperlinked to its case study.  Do you have any insight as to how I can reconcile this?

www.bykatieboyle.com

Thank you again!! I truly appreciate it.

Find this CSS code

div[class*="-item-wrapper"]:after {
    background: #fff;
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity ease 200ms !important;
}

change it to this

div[class*="-item-wrapper"]:after {
    background: #fff;
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity ease 200ms !important;
    pointer-events: none;
}

 

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.