I am attempting to customize the code found at this link so that the box slides to the left side instead of the right.
I thought changing right: 0;
to right: 100%;
in the .overlay class would achieve this, but it is not working as expected. I want it to look like the design shown in this image.
Additionally, when the box slides to the right and I hover over it, I want the box to stay in place until I move my mouse away. How can I resolve this issue?
Below is the CSS code for the animation to the right side:
.container {
position: relative;
width: 50%;
}
.image {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: absolute;
bottom: 0;
left: 100%;
right: 0;
background-color: #008CBA;
overflow: hidden;
width: 0;
height: 100%;
transition: .5s ease;
}
.container:hover .overlay {
width: 100%;
}
.text {
white-space: nowrap;
color: white;
font-size: 20px;
position: absolute;
overflow: hidden;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}