Jump to content

Darken Image blocks on hover in Fluid Engine CSS

Recommended Posts

Site URL: https://www.danieljoseph.com.au/films

Hey there,

I am having trouble with adding a simple hover effect to my image blocks in the new Fluid Engine.

Essentially I am trying to recreate this: http://www.ladybaguette.com/

Currently I have managed to Frankenstein some code which isolates each block individually and achieves the slight fade to black instead of the white background. Although for some reason I can't figure out why my ease transition CSS isn't working.

My Code:
#block-b1dfc7170d9088ca974b:hover .content-fill:after {
   content: "";
    position: absolute;
    background-color: rgba(0,0,0,0.5);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    transition: all .3s;
}
#block-b1dfc7170d9088ca974b:hover .content-fill:after {
    opacity: .3;
    transition: all .3s;
}
 

^^ This is then replicated with the new block ID for the other images

Another problem is that the fade animation will not happen when the cursor is over the text block which is on-top of the image.

Any help in order to fix this would be much appreciated!!

Link to comment
29 minutes ago, Daniel_Joseph said:

Site URL: https://www.danieljoseph.com.au/films

Hey there,

I am having trouble with adding a simple hover effect to my image blocks in the new Fluid Engine.

Essentially I am trying to recreate this: http://www.ladybaguette.com/

Currently I have managed to Frankenstein some code which isolates each block individually and achieves the slight fade to black instead of the white background. Although for some reason I can't figure out why my ease transition CSS isn't working.

My Code:
#block-b1dfc7170d9088ca974b:hover .content-fill:after {
   content: "";
    position: absolute;
    background-color: rgba(0,0,0,0.5);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    transition: all .3s;
}
#block-b1dfc7170d9088ca974b:hover .content-fill:after {
    opacity: .3;
    transition: all .3s;
}
 

^^ This is then replicated with the new block ID for the other images

Another problem is that the fade animation will not happen when the cursor is over the text block which is on-top of the image.

Any help in order to fix this would be much appreciated!!

I try the following code and it seems work properly

#block-b1dfc7170d9088ca974b .content-fill:after {
  content:'';
  opacity: 0;
  position: absolute;
  background-color: rgba(0,0,0,.5);
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  transition: all 1s;
}
#block-b1dfc7170d9088ca974b:hover .content-fill:after {
  opacity: .3;
  transition: all 1s;
}

Support me by pressing 👍 if this useful for you

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Thank you so much! This is working.

It's a small thing, but is there anyway to maintain the hover effect when the cursor is over the text block? Just something I'm noticing that is happening on mine and not the referenced page.

And on an unrelated note, at the bottom of the page where the section meets the footer, there is this odd white gap. Is there any reason as to why the image and the footer isn't lining up perfectly? (see attached)

Screen Shot 2022-10-04 at 10.42.51 am.png

Screen Shot 2022-10-04 at 10.45.50 am.png

Link to comment
On 10/4/2022 at 7:46 AM, Daniel_Joseph said:

Thank you so much! This is working.

It's a small thing, but is there anyway to maintain the hover effect when the cursor is over the text block? Just something I'm noticing that is happening on mine and not the referenced page.

And on an unrelated note, at the bottom of the page where the section meets the footer, there is this odd white gap. Is there any reason as to why the image and the footer isn't lining up perfectly? (see attached)

Screen Shot 2022-10-04 at 10.42.51 am.png

Screen Shot 2022-10-04 at 10.45.50 am.png

#1. Add this code under

.fe-63248c8d498621168046cfc9:hover #block-b1dfc7170d9088ca974b:hover .content-fill:after {
  opacity: .3;
  transition: all 1s;
}

#2. It is a bug..

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

#1. Add this code under

.fe-63248c8d498621168046cfc9:hover #block-b1dfc7170d9088ca974b:hover .content-fill:after {
  opacity: .3;
  transition: all 1s;
}

#2. It is a bug..

#1. This doesn't seem to be working for me? I understand that this line of code should only be working for that block ID but it doesn't darken over the text still. Am I doing something wrong (attached)

#2. Shame about the bug... it's annoying.

 

Screen Shot 2022-10-07 at 12.45.51 pm.png

Link to comment
On 10/7/2022 at 9:46 AM, Daniel_Joseph said:

#1. This doesn't seem to be working for me? I understand that this line of code should only be working for that block ID but it doesn't darken over the text still. Am I doing something wrong (attached)

#2. Shame about the bug... it's annoying.

 

Screen Shot 2022-10-07 at 12.45.51 pm.png

Try this new code

.fe-63248c8d498621168046cfc9:hover #block-b1dfc7170d9088ca974b:hover .content-fill:after {
  opacity: .3;
  transition: all 1s;
    background-color: rgba(0,0,0,.5) !important;
}
.fe-63248c8d498621168046cfc9:hover * {
    cursor: pointer;
}

 

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
On 10/8/2022 at 7:33 PM, tuanphan said:
.fe-63248c8d498621168046cfc9:hover #block-b1dfc7170d9088ca974b:hover .content-fill:after {
  opacity: .3;
  transition: all 1s;
    background-color: rgba(0,0,0,.5) !important;
}
.fe-63248c8d498621168046cfc9:hover * {
    cursor: pointer;
}

Still doesn't work for me 😕 

Link to comment
  • 1 year later...

@tuanphan Apologies for the thread revive and mention. I've been using this code to attempt the same thing on my site and also cannot get this to work. Any chance of a quick update when you get a moment? I've made some assumptions based on the above code by using the text block ID in the second stanza, clearly this isn't correct as only the image darkens and goes light again when the cursor hits the text.

www.orientafricatravel.com/home

#block-yui_3_17_2_1_1679478884804_65665:hover .content-fill:after {
  opacity: .5;
  transition: all 1s;
    background-color: rgba(0,0,0,1) !important;
}
#block-yui_3_17_2_1_1679478884804_73424:hover * {
    cursor: pointer;
}



#block-98e23ec37ec355c43e43:hover .content-fill:after {
  opacity: .5;
  transition: all 1s;
    background-color: rgba(0,0,0,1) !important;
}
#block-bdfaf28773dfaa3a5558:hover * {
    cursor: pointer;
}



#block-0da1641ca41af1469866:hover .content-fill:after {
  opacity: .5;
  transition: all 1s;
    background-color: rgba(0,0,0,1) !important;
}
#block-f53ee2822f6dbaa9b915:hover * {
    cursor: pointer;
}

 

Link to comment
On 3/1/2024 at 3:38 AM, Vulpes said:

@tuanphan Apologies for the thread revive and mention. I've been using this code to attempt the same thing on my site and also cannot get this to work. Any chance of a quick update when you get a moment? I've made some assumptions based on the above code by using the text block ID in the second stanza, clearly this isn't correct as only the image darkens and goes light again when the cursor hits the text.

www.orientafricatravel.com/home

#block-yui_3_17_2_1_1679478884804_65665:hover .content-fill:after {
  opacity: .5;
  transition: all 1s;
    background-color: rgba(0,0,0,1) !important;
}
#block-yui_3_17_2_1_1679478884804_73424:hover * {
    cursor: pointer;
}



#block-98e23ec37ec355c43e43:hover .content-fill:after {
  opacity: .5;
  transition: all 1s;
    background-color: rgba(0,0,0,1) !important;
}
#block-bdfaf28773dfaa3a5558:hover * {
    cursor: pointer;
}



#block-0da1641ca41af1469866:hover .content-fill:after {
  opacity: .5;
  transition: all 1s;
    background-color: rgba(0,0,0,1) !important;
}
#block-f53ee2822f6dbaa9b915:hover * {
    cursor: pointer;
}

 

For these image blocks?

image.thumb.png.6b137a1f8afda3ccf6f5fdb8d1e178a2.png

with first image, use this CSS code

#block-yui_3_17_2_1_1679478884804_65665 .content-fill:after {
  transition: all 1s;
  background-color: rgba(0,0,0,5) !important;
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  opacity: 0;
}
#block-yui_3_17_2_1_1679478884804_65665:hover .content-fill:after {
  opacity: 1 !important;
}

With other images, you can do similar

 

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

Thanks @tuanphan

Yes, you got it, those blocks. Thanks for the code, this works the same as before but I still have the same issues with hovering over the text which ignores the image opacity. Is this the bug you mentioned above or something we can fix with CSS?

Thank you again for your time.

Link to comment
23 hours ago, Vulpes said:

Thanks @tuanphan

Yes, you got it, those blocks. Thanks for the code, this works the same as before but I still have the same issues with hovering over the text which ignores the image opacity. Is this the bug you mentioned above or something we can fix with CSS?

Thank you again for your time.

I see it already worked here, you try checking it again

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

I see it already worked here, you try checking it again

Thanks, it could be my browser but on Chrome, when I hover over the text with the cursor the image returns to being visible.

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.