I simply need two photos with half of each photo (left half visible from left image. right half visible from right image) both images are facing each other. When hover on left image it shows it's right half and disappears right side image. And When hover on right image it shows it's left half and left image disappears.
I tried using overflow:hidden
and direction:rtl
to hide the left side of right image. Default hides right side.
So when I hover on left image it works perfect and shows hidden part from right side.
But when I hover on left image I can't get the hidden part from left side.
.imagea {
max-width: 250px;
overflow: hidden;
transition: 2s;
}
.imageb {
max-width: 250px;
overflow: hidden;
direction: rtl;
transition: 2s;
}
.imagea:hover {
max-width: 100%;
}
.imagea:hover~.imageb {
max-width: 0px;
}
.imageb:hover {
max-width: 100%;
}
.imageb:hover .imagea {
max-width: 0px;
}
<div class="imagea">
<img src="https://via.placeholder.com/250" />
</div>
<div class="imageb">
<img src="https://via.placeholder.com/250" />
</div>