<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/stickyfill/2.0.0/stickyfill.min.js">
</script>
<style>@charset "utf-8";
/*========= 紙芝居風レイアウトのためのCSS ===============*/
section.fixed {
position: -webkit-sticky; /*Safari*/
position: sticky;
top: 70px; /*Header高さ分で止まるようにする*/
/*装飾のためのCSS*/
background: #fff;
padding: 100px 30px 170px 30px;
min-height: 100vh;
}
section.fixed:nth-of-type(2n) {
/*装飾のためのCSS*/
color: #fff;
text-align: center;
padding: 300px 30px;
min-height: auto;
}
section.fixed:last-of-type {
padding: 170px 30px 100px 30px; /*最後のセクションだけ止まらないため、エリア内の情報が少ない時は、HEADER分の高さをpadding-topに追加して上部が見えるようにする*/
}
section.fixed:nth-of-type(2) {
background: url("/wp-content/uploads/demos/_assets/nail2.jpg") no-repeat
center;
background-size: cover;
}
section.fixed:nth-of-type(4) {
background: url("/wp-content/uploads/demos/_assets/nail3.jpg") no-repeat
center;
background-size: cover;
}
/*========= スクロールダウンのためのCSS ===============*/
/*スクロールダウン全体の場所*/
.scrolldown {
/*描画位置※位置は適宜調整してください*/
position: absolute;
bottom: 10px;
right: 50%;
/*マウスの動き1.6秒かけて動く永遠にループ*/
animation: mousemove 1.6s ease-in-out infinite;
}
/*下からの距離が変化して上から下に動く*/
@keyframes mousemove {
0% {
bottom: 10px;
}
50% {
bottom: 5px;
}
100% {
bottom: 10px;
}
}
/*Scrollテキストの描写*/
.scrolldown span {
z-index: 10;
/*描画位置*/
position: absolute;
left: -15px;
bottom: 45px;
/*テキストの形状*/
color: #333;
font-size: 0.7rem;
letter-spacing: 0.05em;
white-space: nowrap;
}
/*マウスの中の線描写 */
.scrolldown span::after {
z-index: 10;
content: "";
/*描画位置*/
position: absolute;
top: 10px;
left: 17px;
/*線の形状*/
width: 1px;
height: 15px;
background: #333;
/*線の動き1.4秒かけて動く。永遠にループ*/
animation: mousepathmove 1.4s linear infinite;
opacity: 0;
}
/*上からの距離・不透明度・高さが変化して上から下に流れる*/
@keyframes mousepathmove {
0% {
height: 0;
top: 10px;
opacity: 0;
}
50% {
height: 15px;
opacity: 1;
}
100% {
height: 0;
top: 30px;
opacity: 0;
}
}
/*マウスの描写 */
.scrolldown:before {
z-index: 10;
content: "";
/*描画位置*/
position: absolute;
bottom: 0;
left: -10px;
/*マウスの形状*/
width: 25px;
height: 37px;
border-radius: 10px;
border: 1px solid #333;
}
/*マウスの中の丸の描写*/
.scrolldown:after {
z-index: 10;
content: "";
/*描画位置*/
position: absolute;
bottom: 26px;
left: 0;
/*丸の形状*/
width: 5px;
height: 5px;
border-radius: 50%;
border: 1px solid #333;
}
/*===========タブレット以下の見え方=============*/
@media screen and (max-width: 768px) {
section.fixed,
section.fixed:last-of-type {
position: relative !important; /*sticky解除*/
top: 0; /*70px⇒0pxに戻す*/
min-height: auto;
padding: 30px;
}
section.fixed:first-of-type {
padding: 100px 30px 30px 30px; /*最初の要素は上部にHeaderの高さ以上の余白をとる*/
}
section.fixed:nth-of-type(2n) {
padding: 100px 30px;
}
}
/*========= レイアウトのためのCSS ===============*/
h1 {
font-size: 1.2rem;
}
#container h2 {
font-size: 1.2rem;
}
#container p {
margin-top: 20px;
}
small {
background: #333;
color: #fff;
display: block;
text-align: center;
padding: 20px;
}
#header {
position: fixed; /*Header固定*/
top: 0;
height: 70px; /*高さ指定*/
z-index: 2;
width: 100%;
/*装飾のためのCSS*/
background: #333;
color: #fff;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
#container {
position: relative;
z-index: 1; /*header とfooterを手前にするため数字を小さく*/
}
#footer {
position: relative;
z-index: 2;
}</style>
</head>
<body>
<body>
<header id="header">
<h1>WEB先案内</h1>
</header>
<div class="scrolldown">
<span>Scroll</span>
</div>
<main id="container">
<section class="fixed">
<h2>Area 1</h2>
<p>テキストが入ります。</p>
<!--/area1-->
</section>
<section class="fixed">
<h2>Area 2</h2>
<!--/area2-->
</section>
<section class="fixed">
<h2>Area 3</h2>
<p>テキストが入ります。</p>
<!--/area3-->
</section>
<section class="fixed">
<h2>Area 4</h2>
<!--/area4-->
</section>
<section class="fixed">
<h2>Area 5</h2>
<p>テキストが入ります。</p>
<!--/area5-->
</section>
<!--/main-->
</main>
<footer id="footer">
<small>© copyright.</small>
</footer>
<script>/* 768px以上で、position: sticky;に対応していないブラウザは『1カラム』表示する */
$(window).on("load resize", function () {
var windowWidth = window.innerWidth;
var elements = $(".fixed");
if (windowWidth >= 768) {
Stickyfill.add(elements);
} else {
Stickyfill.remove(elements);
}
});
//# sourceURL=pen.js</script>
</body>
</html>
/*
外部依存 CSS:
- https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css
外部依存 JS (このデモは下記の JS にも依存します):
- https://code.jquery.com/jquery-3.4.1.min.js
- https://cdnjs.cloudflare.com/stickyfill.min.js
*/
@charset "utf-8";
/*========= 紙芝居風レイアウトのためのCSS ===============*/
section.fixed {
position: -webkit-sticky; /*Safari*/
position: sticky;
top: 70px; /*Header高さ分で止まるようにする*/
/*装飾のためのCSS*/
background: #fff;
padding: 100px 30px 170px 30px;
min-height: 100vh;
}
section.fixed:nth-of-type(2n) {
/*装飾のためのCSS*/
color: #fff;
text-align: center;
padding: 300px 30px;
min-height: auto;
}
section.fixed:last-of-type {
padding: 170px 30px 100px 30px; /*最後のセクションだけ止まらないため、エリア内の情報が少ない時は、HEADER分の高さをpadding-topに追加して上部が見えるようにする*/
}
section.fixed:nth-of-type(2) {
background: url("/wp-content/uploads/demos/_assets/nail2.jpg") no-repeat
center;
background-size: cover;
}
section.fixed:nth-of-type(4) {
background: url("/wp-content/uploads/demos/_assets/nail3.jpg") no-repeat
center;
background-size: cover;
}
/*========= スクロールダウンのためのCSS ===============*/
/*スクロールダウン全体の場所*/
.scrolldown {
/*描画位置※位置は適宜調整してください*/
position: absolute;
bottom: 10px;
right: 50%;
/*マウスの動き1.6秒かけて動く永遠にループ*/
animation: mousemove 1.6s ease-in-out infinite;
}
/*下からの距離が変化して上から下に動く*/
@keyframes mousemove {
0% {
bottom: 10px;
}
50% {
bottom: 5px;
}
100% {
bottom: 10px;
}
}
/*Scrollテキストの描写*/
.scrolldown span {
z-index: 10;
/*描画位置*/
position: absolute;
left: -15px;
bottom: 45px;
/*テキストの形状*/
color: #333;
font-size: 0.7rem;
letter-spacing: 0.05em;
white-space: nowrap;
}
/*マウスの中の線描写 */
.scrolldown span::after {
z-index: 10;
content: "";
/*描画位置*/
position: absolute;
top: 10px;
left: 17px;
/*線の形状*/
width: 1px;
height: 15px;
background: #333;
/*線の動き1.4秒かけて動く。永遠にループ*/
animation: mousepathmove 1.4s linear infinite;
opacity: 0;
}
/*上からの距離・不透明度・高さが変化して上から下に流れる*/
@keyframes mousepathmove {
0% {
height: 0;
top: 10px;
opacity: 0;
}
50% {
height: 15px;
opacity: 1;
}
100% {
height: 0;
top: 30px;
opacity: 0;
}
}
/*マウスの描写 */
.scrolldown:before {
z-index: 10;
content: "";
/*描画位置*/
position: absolute;
bottom: 0;
left: -10px;
/*マウスの形状*/
width: 25px;
height: 37px;
border-radius: 10px;
border: 1px solid #333;
}
/*マウスの中の丸の描写*/
.scrolldown:after {
z-index: 10;
content: "";
/*描画位置*/
position: absolute;
bottom: 26px;
left: 0;
/*丸の形状*/
width: 5px;
height: 5px;
border-radius: 50%;
border: 1px solid #333;
}
/*===========タブレット以下の見え方=============*/
@media screen and (max-width: 768px) {
section.fixed,
section.fixed:last-of-type {
position: relative !important; /*sticky解除*/
top: 0; /*70px⇒0pxに戻す*/
min-height: auto;
padding: 30px;
}
section.fixed:first-of-type {
padding: 100px 30px 30px 30px; /*最初の要素は上部にHeaderの高さ以上の余白をとる*/
}
section.fixed:nth-of-type(2n) {
padding: 100px 30px;
}
}
/*========= レイアウトのためのCSS ===============*/
h1 {
font-size: 1.2rem;
}
#container h2 {
font-size: 1.2rem;
}
#container p {
margin-top: 20px;
}
small {
background: #333;
color: #fff;
display: block;
text-align: center;
padding: 20px;
}
#header {
position: fixed; /*Header固定*/
top: 0;
height: 70px; /*高さ指定*/
z-index: 2;
width: 100%;
/*装飾のためのCSS*/
background: #333;
color: #fff;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
#container {
position: relative;
z-index: 1; /*header とfooterを手前にするため数字を小さく*/
}
#footer {
position: relative;
z-index: 2;
}
/*
外部依存 JS:
- https://code.jquery.com/jquery-3.4.1.min.js
- https://cdnjs.cloudflare.com/stickyfill.min.js
外部依存 CSS (このデモは下記の CSS にも依存します):
- https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css
*/
/* 768px以上で、position: sticky;に対応していないブラウザは『1カラム』表示する */
$(window).on("load resize", function () {
var windowWidth = window.innerWidth;
var elements = $(".fixed");
if (windowWidth >= 768) {
Stickyfill.add(elements);
} else {
Stickyfill.remove(elements);
}
});
//# sourceURL=pen.js