<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<style>
body, html {
margin: 0;
padding: 0;
height: 100%;
overflow-x: hidden;
}
section {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
transition: background-color 0.5s;
}
#section1 {
background-color: #ededee;
cursor: pointer;
position: relative;
}
#section2 {
height: 100vh;
overflow: hidden;
background-color: #white;
position: relative;
z-index : 0;
}
.random-image {
max-width: 200%;
max-height: 200%;
object-fit: cover;
}
.text-overlay {
position: absolute;
top: 20%;
width: 100%;
text-align: center;
font-size: 5em;
font-weight: bold;
color: #000;
pointer-events: none;
}
.image {
position: absolute;
transition: all 2s ease;
opacity: 0;
}
.image:nth-child(1) {
top: -30%;
left: -100%;
}
.image:nth-child(2) {
top: -15%;
left: 100%;
}
.image:nth-child(3) {
top: 0%;
left: -100%;
}
.image:nth-child(4) {
top: 15%;
left: 100%;
}
.image:nth-child(5) {
top: 30%;
left: -100%;
}
.image:nth-child(6) {
top: 45%;
left: 100%;
}
.image:nth-child(1).show {
left: -10%;
opacity: 1;
}
.image:nth-child(2).show {
left: 20%;
opacity: 1;
}
.image:nth-child(3).show {
left: 5%;
opacity: 1;
}
.image:nth-child(4).show {
left: 35%;
opacity: 1;
}
.image:nth-child(5).show {
left: -10%;
opacity: 1;
}
.image:nth-child(6).show {
left: 20%;
opacity: 1;
}
.image.exit-to-left {
left: -150%;
opacity: 0;
}
.image.exit-to-right {
left: 150%;
opacity: 0;
}
</style>
</head>
<body>
<section id="section1">
<div class="text-overlay">Superonda</div>
<img src="image1.png" alt="" class=">
</section>
<section id="section2">
<img src="image.png" alt="image 1" width="80%" height="100%">
<img src="image2.png" alt="image 2" width="80%" height="100%">
<img src="image3.png" alt="image 3" width="80%" height="100%">
<img src="image4.png" alt="image 4" width="80%" height="100%">
<img src="image5.png" alt="image 5" width="80%" height="100%">
<img src="image6.png" alt="image 6" width="80%" height="100%">
</section>
</body>
</html>
The code above is written by me, but when I scroll through the page using the z-index property, I thought that when section 2 appears, it will appear covering section 1. That’s the effect I wanted, but it doesn’t work properly
The code above is written by me, but when I scroll through the page using the z-index property, I thought that when section 2 appears, it will appear covering section 1. That’s the effect I wanted, but it doesn’t work properly
문태호 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.