4
I have an animation where an element appears entering from left to right when I do the :hover
in the .box
, but I would like that when I took the mouse from the .box
the element now exits from the right.
The idea is like this, when you put the mouse in the box
the element enters from the left and when you take the mouse the element leaves from the right.
(That is, in the hover
the element comes in and stops in the middle, how much comes out of the hover
the entered element exits from the other side)
And I’d like something like the image above...
What I have achieved so far is the element coming in from the left and also coming out from the left, but I want it to come out from the other side!
OBS: I left the overflow: hidden
commented in the CSS for easy visualization of the animation, but at the end I will use with the overflow
activated!
.box {
width: 100px;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid;
margin: auto;
position: relative;
/* overflow: hidden; */
}
.filho {
width: 30px;
height: 30px;
background-color: red;
position: relative;
left: -100%;
transition: left 500ms;
}
.box:hover .filho {
left: 0%;
}
Quando tirar o mouse o bloco vermelho deve sair pela direita...<br><br>
<div class="box">
<div class="filho"></div>
</div>