Jump to content

How to change image opacity while leaving overlaying text

Recommended Posts

So I am trying to emulate this website's specific page: https://www.bakerlab.org/index.php/members/

I have the code to change opacity of images, but when I use the "poster" setting for the images (for the overlaying text on it), the code impacts the text and makes it blurry/white. I don't want the text to be impacted by the filter/opacity, but I want it to disappear with the hover function. How do I separate the text from the filter overlay but keep it together with the hover function?

What I want is the image to have a lower opacity with text overlay that is visible, but then when the user hovers over the image, both the text disappears and the image is in full quality and color. Here is my code so far.

 

<style>
  
.image-block {
      -webkit-filter: opacity(70%); 
    filter: white(25%);
}

.image-block:hover {
      transition: filter .5s ease-in-out; 
    -webkit-filter: opacity(100%);
    filter:opacity(100%);
}

  .image-block:hover .image-card-wrapper {
    opacity: 0;
    transition: all ease-in-out 0.5s;
}
  
</style>

 

Thanks in advance!

Link to comment
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

It seems you solved? 

--

some suggestions

You can add transition, the effect looks nicer.

Also, you can use Lightbox Bio, Instead of going to the other pages, I recently did a similar case for clients. Follow this guide.

Edited by tuanphan

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
9 hours ago, tuanphan said:

It seems you solved? 

--

some suggestions

You can add transition, the effect looks nicer.

Also, you can use Lightbox Bio, Instead of going to the other pages, I recently did a similar case for clients. Follow this guide.

It's not fixed. The text is affected by the opacity of the image so it looks faded and not like the website above. I will use the code you provided though, thanks!

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.