<div class="page-wrapper">
<div class="content-wrapper">
<input type="radio" name="toggle" id="toggle1">
<input type="radio" name="toggle" id="toggle2">
<input type="radio" name="toggle" id="toggle3">
<section id="section-1">
<div class="image-container">
<img src="https://unsplash.it/500/600?image=939" alt="">
</div>
<div class="info-container">
<h1>Hello.</h1>
<label for="toggle2">Click Me.</label>
</div>
</section>
<section id="section-2">
<div class="image-container">
<img src="https://unsplash.it/500/600?image=868" alt="">
</div>
<div class="info-container">
<h1>Hello Again.</h1>
<label for="toggle3">Click Me.</label>
</div>
</section>
</div>
</div>
.page-wrapper {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
}
.content-wrapper {
display: flex;
width: 80vw;
min-height: 80vh;
position: relative;
}
input {
display: none;
}
#section-1, #section-2 {
display: flex;
width: 80vw;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
#section-1 {
opacity: 1;
z-index: 5;
transition: transform 0.5s, opacity 0.5s;
}
#section-2 {
opacity: 0;
transition: transform 0.5s, opacity 0.5s;
}
.image-container {
width: 50%;
height: 100%;
background-color: lightblue;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
img {
flex-shrink: 0;
min-width: 100%;
min-height: 100%;
}
.info-container {
width: 50%;
height: 100%;
background-color: lightsalmon;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#section-2 .image-container {
opacity: 0;
transform: translateY(2em);
transition: all 1s 0.7s;
}
#section-2 .info-container {
opacity: 0;
transform: translateY(-2em);
transition: all 1s 0.7s;
}
label {
display: block;
border: solid 2px black;
padding: 1em 2em;
border-radius: 5px;
cursor: pointer;
}
#toggle2:checked ~ #section-2 {
opacity: 1;
}
#toggle2:checked ~ #section-1 {
opacity: 0;
transform: scale(0.95);
pointer-events: none;
}
#toggle2:checked ~ #section-2 .image-container,
#toggle2:checked ~ #section-2 .info-container {
opacity: 1;
transform: translateY(0);
}
#toggle3:checked ~ #section-1 {
transition: transform 0.5s 0.5s, opacity 0.5s 0.5s;
}
#toggle3:checked ~ #section-2 .image-container,
#toggle3:checked ~ #section-2 .info-container {
transition: transform 0.5s, opacity 0.5s;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.