Jump to content

7.1 Gallery Image: overlay and caption on hover

Recommended Posts

Site URL: http://www.maggiebrz.design

Hi everyone! 

I just switched from 7.0 to 7.1.  In the masonry gallery grid, I'm trying to add hover effects to my images- a color overlay and image caption on hover. I talked to customer support, and they told me that 7.1 doesn't support gallery hovers.  I'm having trouble with the code, and was wondering if anyone had more luck than I did? 

I've attached a screen shot of how the site is set up. I'm trying to keep the full-bleed effect.

I've been stuck in a rabbit hole working on this all day - thanks for the help!!

Screen Shot 2020-08-14 at 4.18.03 PM.png

Edited by maggierae
typos
Link to comment

Add to Page Settings > Advanced > Header

<style>
figure.gallery-masonry-item {
    position: relative;
}
.gallery-caption {
    position: static;
}
/* title */
.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;
}
.gallery-masonry-item:hover .gallery-caption-content {
    opacity: 1 !important;
}
/* overlay */
.gallery-masonry-item-wrapper a: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;
}
.gallery-masonry-item:hover .gallery-masonry-item-wrapper a:after {
    opacity: 0.75;
}
/* remove gap */
figcaption {
    padding: 0 !important;
}
</style>

 

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 hour ago, tuanphan said:

Add to Page Settings > Advanced > Header


<style>
figure.gallery-masonry-item {
    position: relative;
}
.gallery-caption {
    position: static;
}
/* title */
.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;
}
.gallery-masonry-item:hover .gallery-caption-content {
    opacity: 1 !important;
}
/* overlay */
.gallery-masonry-item-wrapper a: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;
}
.gallery-masonry-item:hover .gallery-masonry-item-wrapper a:after {
    opacity: 0.75;
}
/* remove gap */
figcaption {
    padding: 0 !important;
}
</style>

 

Is there any way to add the code to the overall CSS so that I don't have to upgrade (individual page CSS requires business plan)? If not, totally fine, it's worth it!  Thank you so much!

Link to comment
21 hours ago, maggierae said:

Is there any way to add the code to the overall CSS so that I don't have to upgrade (individual page CSS requires business plan)? If not, totally fine, it's worth it!  Thank you so much!

With Personal Plan > Edit Page > Add Code Block > Paste above code

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
  • 9 months later...
On 5/26/2021 at 11:07 PM, jenmaherconsulting said:

@tuanphan Thank you so much for this code!  It worked great!  However, do you happen to have an extra snippet that I can add that would allow the captions to still show when the image is lightboxed? 

 

Use this code

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
  • 2 weeks later...
On 6/8/2021 at 5:03 AM, Swharton24 said:

@tuanphan for some reason when I use this code, the overlay effect doesn't show up. The caption seems to be working fine. Any ideas? 

https://fish-nectarine-wbzr.squarespace.com/video-test

pw: c?yNhS8>vmJd`YMA

Hi. I see overlay here

image.thumb.png.b3fc8883fd08c19ef4e115235963cf3c.png

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...
On 8/10/2021 at 1:09 AM, Will123 said:

@tuanphan Hi,  I used your code however, the overlay color doesnt show up. The caption seems to be working tho. Do you know whats the problem? 

https://www.unswaseanconference.com/about-asean-2021-v2

Hi. Where is gallery? I don't see on this page

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
  • 2 months later...
On 11/18/2021 at 1:10 AM, TomCharlesworth said:

Hi @tuanphan,

Apologies for digging up an old post, i've been using our code for a while now with no issues, but it's suddenly started displaying all the captions even when not overlayed.

I haven't done anything to cause this to my knowledge.

https://www.tomcharlesworthillustration.co.uk/

Is there an easy fix?

Thanks.

Hi,

I see title/overlay here?

image.thumb.png.a2eba97018028af52d5c1178c9512814.png

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
  • 2 months later...

Hi taunphan! This code is amazing, and I know I'm late to this party.

Is there a way to change the color of the caption text? The overlay and caption both work great, but the caption is currently black and I'd love for it to be a different color.

Also, any image I've added after I put in the code, the caption shows up, but not the overlay hover...any ideas how to fix?

Thanks!

Edited by agtrymus
Link to comment
On 2/4/2022 at 12:12 AM, agtrymus said:

Hi taunphan! This code is amazing, and I know I'm late to this party.

Is there a way to change the color of the caption text? The overlay and caption both work great, but the caption is currently black and I'd love for it to be a different color.

Also, any image I've added after I put in the code, the caption shows up, but not the overlay hover...any ideas how to fix?

Thanks!

#1. Add this before </style>

.gallery-caption-content * {
	color: red !important;
}

#2. Can you share link to your site? We can check your case easier

 

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
  • 2 weeks later...

Hey @tuanphan 🙂 Thanks so much for providing this code!

If possible I would love some help please as no matter what I do I can't seem to get this code to work for the gallery on the home page. I've tried to include it in a few places but it won't work and thus I can't achieve the centred, overlaid hover captions I desire. 

Any advice would be greatly appreciated!! https://pelican-fennel-8p7z.squarespace.com/

Thanks!

Link to comment
On 2/22/2022 at 9:37 AM, kiaraminette said:

Hey @tuanphan 🙂 Thanks so much for providing this code!

If possible I would love some help please as no matter what I do I can't seem to get this code to work for the gallery on the home page. I've tried to include it in a few places but it won't work and thus I can't achieve the centred, overlaid hover captions I desire. 

Any advice would be greatly appreciated!! https://pelican-fennel-8p7z.squarespace.com/

Thanks!

Your site is private. You can setup password & share url again. We can check easier

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
  • 4 months later...

Hello @tuanphan, I would like to use 

On 8/17/2020 at 10:21 AM, tuanphan said:

Add to Page Settings > Advanced > Header

<style>
figure.gallery-masonry-item {
    position: relative;
}
.gallery-caption {
    position: static;
}
/* title */
.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;
}
.gallery-masonry-item:hover .gallery-caption-content {
    opacity: 1 !important;
}
/* overlay */
.gallery-masonry-item-wrapper a: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;
}
.gallery-masonry-item:hover .gallery-masonry-item-wrapper a:after {
    opacity: 0.75;
}
/* remove gap */
figcaption {
    padding: 0 !important;
}
</style>

 

Hello @tuanphan, I would like to use this code but on the "slideshow: reel" gallery type instead. Would you happen to be able to provide a version of the code that would work for this? :)

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.