<div class="wrap section1">
<div class="container">
<p>スクロールしてみよう!</p>
</div>
</div>
<div class="wrap section2">
<div class="container">
<img class="lazyload" width="400" height="300" data-src="https://drive.google.com/uc?export=view&id=1gfZjLzG4BXU-ieu5Vb2K6ZMQ6GcMlU2e" alt="" data-expand="-20" />
</div>
<div class="container">
<img data-src="https://drive.google.com/uc?export=view&id=172pIgbAQZlAWJ18GFLXM9MoWbbi8XfxU" alt="" class="lazyload" width="400" height="300" data-expand="-20" />
</div>
<div class="container">
<img data-src="https://drive.google.com/uc?export=view&id=10YpX23wkcjRflfloUt7tqLeumpias42N" alt="" class="lazyload" width="400" height="300" data-expand="-20" />
</div>
<div class="container">
<img data-src="https://drive.google.com/uc?export=view&id=10mqA1CfPi8N9_McRCe0bOGR_jUHzPEch" alt="" class="lazyload" width="400" height="300" data-expand="-20" />
</div>
<div class="container">
<img data-src="https://drive.google.com/uc?export=view&id=1gfZjLzG4BXU-ieu5Vb2K6ZMQ6GcMlU2e" alt="" class="lazyload" width="400" height="300" data-expand="-20" />
</div>
<div class="container">
<img data-src="https://drive.google.com/uc?export=view&id=10YpX23wkcjRflfloUt7tqLeumpias42N" alt="" class="lazyload" width="400" height="300" data-expand="-20" />
</div>
</div>
html,
body {
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
}
.wrap {
max-width: 1240px;
margin: 0 auto;
padding: 20px 20px;
}
.section1 {
height: 100vh;
}
.section2 {
height: 200vh;
}
.container {
margin: 4rem 0;
text-align: center;
}
.container p {
font-size: 2rem;
}
.container img {
width: 80%;
height: auto;
vertical-align: top;
background-color: silver;
opacity: 0; /* 読み込んだ瞬間は透明に */
}
/* lazyloadedになったらfadeアニメーションを実行 */
.container img.lazyloaded {
animation: fade 1s forwards;
}
/* fadeアニメーション */
@keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
This Pen doesn't use any external CSS resources.