Issue
I have a nav
component as shown below with four props that are all booleans used to control UI styling
const Nav = ({ isNav, isVisibleTwo, isVisibleThree, isVisibleFour }) => {
return (
<nav className={isNav ? 'bubbs bubbs-enter' : 'bubbs'}>
<GiHamburgerMenu />
<a href="#projects-title">
<div className={isVisibleFour ? 'bubble bubble-active' : 'bubble'}>
<p>{`//`} P</p>
</div>
</a>
<a href="#resume-title">
<div className={isVisibleTwo ? 'bubble bubble-active' : 'bubble'}>
<p>{`//`} R</p>
</div>
</a>
<a href="#contact-me">
<div className={isVisibleThree ? 'bubble bubble-active' : 'bubble'}>
<p>{`//`} C</p>
</div>
</a>
</nav>
)
}
isNav
controls whether the nav
is visible or not by toggling classes that control opacity.
bubbs-enter
sets opacity: 0.7
the problem I'm having is if the bubble-active
class is applied I want the opacity of the bubble to be set to 1. Which is not working currently because the nav
opacity is set to .7
is there a valid work around for this?
CSS
nav {
width: 6rem;
position: sticky;
top: 0;
align-self: flex-end;
z-index: 5;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 3.2rem;
/* padding-top: 3rem; */
}
.bubbs {
opacity: 0;
transition: opacity 400ms ease-in;
}
.bubbs > svg {
color: white;
font-size: 1.8rem;
margin-bottom: .5rem;
}
.bubbs-enter {
opacity: .7;
}
.bubbs-enter:hover{
opacity: 1;
border-left: 1px solid rgba(82, 82, 82, 0.246)
}
.bubble {
aspect-ratio: 1;
border: 1px solid rgba(74, 74, 74, 0.216);
width: 3.6rem;
border-radius: 50%;
display: grid;
place-items: center;
margin: .5rem 0;
backdrop-filter: blur(2px);
cursor: pointer;
background-color: rgba(28, 28, 28, 0.349);
transition: all ease 350ms;
}
.bubble:hover {
transform: scale(1.06);
}
.bubble p {
color: rgb(240, 240, 240);
margin: 0;
font-size: 1.3rem;
text-transform: capitalize;
transition: all ease 550ms;
}
.bubble-active {
background-color: rgb(255, 255, 255);
transform: scale(1.06);
}
.bubble-active > p {
color: red;
}
Solution
What you're trying to achieve is a bit complex to achieve with CSS. You may want to take a look at setting the opacity of each child element than setting the opacity of the parent.
Take a look at the answers in this thread
Answered By - elcharitas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.