I wanna create titles for a menu bar (that discribe what that syble means in the menu). So once the use hover the menu, I want to display the titles with smooth animation and keep then until the user hover the menu. It's posible to do with Java Script but I'm finding a way to do that only with CSS. couse I think it's so efficient.
index.html
<div class="menu-bar-holder">
<div class="sub-menu-bar">
<div class="menu-item" onclick="window.location.href='../'">
<img src="../images/logo-hero.png" alt="">
</div>
<!--
<div class="menu-item go-top-menu" onclick="topFunction()" id="">
<img src="../images/svg/extension-puzzle-outline.svg" alt="">
</div>-->
<div class="menu-item">
<img src="../images/svg/apps-outline.svg" alt="">
</div>
<hr width="100%" color="black">
<div class="menu-item">
<img src="../images/svg/cart-outline.svg" alt="">
</div>
<div class="menu-item">
<img src="../images/svg/log-in-outline.svg" alt="">
</div>
</div>
<div class="sub-menu-bar-item-names">
<div class="menu-item">Home page</div>
<!--<div class="menu-item go-top-menu" id="">go to the top</div>-->
<div class="menu-item">catogories</div>
<hr width="0" color="white" style="opacity: 0; visibility: hidden;">
<div class="menu-item">cart</div>
<div class="menu-item">log-in</div>
</div>
</div>
style.css
.sub-menu-bar-item-names .menu-item{
width: fit-content;
height: 50px;
padding-left: 10px;
padding-right: 10px;
display: flex;
justify-content: center;
align-items: center;
background-color: #ffffff66;
box-shadow: rgba(17, 17, 26, 0.1) 0px 8px 24px, rgba(17, 17, 26, 0.1) 0px 16px 56px, rgba(17, 17, 26, 0.1) 0px 24px 80px;
backdrop-filter: blur(20px);
margin-top: 5px;
margin-bottom: 5px;
border-radius: 10px;
cursor: pointer;
transition-duration: 1s;
transform: translateX(-300px);
opacity: 0;
transition-delay: 0.1s;
visibility: hidden;
z-index: 0;
display: none;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
visibility: visible;
transform: translateX(0px);
-webkit-animation-play-state:paused;
-moz-animation-play-state:paused;
-o-animation-play-state:paused;
animation-play-state:paused;
cursor: pointer;
}
}
/*https://stackoverflow.com/questions/4502633/how-to-affect-other-elements-when-one-element-is-hovered*/
body:has(.sub-menu-bar .menu-item:hover) .sub-menu-bar-item-names .menu-item {
display: flex;
animation: fadeIn 1s;
}
I wanna pause the fadeIn animation, when once it played, until the .sub-menu-bar .menu-item:hover