I have an animation where an element appears entering from left to right when I do the :hover
in the .box
, however I would like that when I take the mouse out of .box
the element would exit right now.
The idea is like this, when you put the mouse in box
, the element enters from the left and when you take the mouse, the element exits from the right. in% with the element it enters and stops in the middle , how much leaves hover
the element that entered leaves on the other side)
AndIwouldlikesomethingliketheimageabove...
WhatIhaveachievedsofaristheelemententeringfromtheleftandtbcomingoutfromtheleft,butIwantittocomeouttheotherside!I'veleftthehover
commentedoutintheCSStomakeiteasiertoseetheanimation,butintheendI'mgoingtouseitwithoverflow:hidden
enabled!
.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>