I'm running in to an issue when trying to get different layers to fade different opacities. I've got the card element (in the code below) that I want to keep at the background opacity of 50, and make the text opacity 100 on hover.
Right now when hovering over the card everything stays at at opacity-50 and I can't get the text to change to opacity-100. I tried setting the card title opacity to 100, but it seems like the parent container is overriding the child opacity.
Any suggestions as to how to fix this?
import React from "react";
import greenBlock from "../assets/images/homeLayout/heroPhotos/1.jpg";
import yellowBlock from "../assets/images/homeLayout/heroPhotos/2.jpg";
import redBlock from "../assets/images/homeLayout/heroPhotos/8.jpg";
const HomeHero = () => {
return (
<>
<div className="grid w-full h-screen grid-cols-1 lg:grid-cols-3">
<div className="group">
<div
className="flex items-center justify-center order-1 object-cover w-full h-screen text-black transition duration-500 ease-in-out bg-cover saturate-100 group-hover:saturate-50"
style={{ backgroundImage: `url(${greenBlock})` }}
>
<div className="flex justify-center transition duration-500 ease-in-out opacity-0 group-hover:opacity-100">
<div class="card w-96 bg-neutral text-neutral-content opacity-50">
<div class="card-body items-center text-center opacity-100">
<h2 class="card-title opacity-100">Title!</h2>
<p>We are using cookies for no reason.</p>
<div class="justify-end card-actions">
<button class="btn btn-primary">Accept</button>
<button class="btn btn-ghost">Deny</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="group">
<div
className="flex items-center justify-center order-1 object-cover w-full h-screen text-black transition duration-500 ease-in-out bg-cover saturate-100 group-hover:saturate-50"
style={{ backgroundImage: `url(${yellowBlock})` }}
>
<div className="flex justify-center transition duration-500 ease-in-out opacity-0 group-hover:opacity-100">
<div className="block max-w-sm text-center bg-white rounded-lg shadow-lg ">
<div className="px-6 py-3 border border-gray-300 rounded-lg">
<div class="p-6">
<h5 class="text-gray-900 text-xl font-medium mb-2">
Special title treatment
</h5>
<p class="text-gray-700 text-base mb-4">
With supporting text below as a natural lead-in to
additional content.
</p>
<button
type="button"
class=" inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out"
>
Button
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="group">
<div
className="flex items-center justify-center order-1 object-cover w-full h-screen text-black transition duration-500 ease-in-out bg-cover saturate-100 group-hover:saturate-50"
style={{ backgroundImage: `url(${redBlock})` }}
>
<div className="flex justify-center transition duration-500 ease-in-out opacity-0 group-hover:opacity-100">
<div className="block max-w-sm text-center bg-white rounded-lg shadow-lg ">
<div className="px-6 py-3 border border-gray-300 rounded-lg">
<div class="p-6">
<h5 class="text-gray-900 text-xl font-medium mb-2">
Special title treatment
</h5>
<p class="text-gray-700 text-base mb-4">
With supporting text below as a natural lead-in to
additional content.
</p>
<button
type="button"
class=" inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out"
>
Button
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</>
);
};
export default HomeHero;