Kids-U

幼児教育
クリエイター: こまつやデザイン
基本的なレイアウトに加えて、positionを使用して画像などを配置する箇所が含まれています。
ソースコード
HTML
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- リセットCSS-->
<link rel="stylesheet" href="css/destyle.css">
<!-- Fontawesome -->
<script src="https://kit.fontawesome.com/1f7d34d054.js" crossorigin="anonymous"></script>
<!--GoogleFonts-->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;700&display=swap" rel="stylesheet">
<!-- CSS -->
<link rel="stylesheet" href="css/style.css">
<title>Kids-U</title>
</head>
<body>
<!-- header -->
<header id="header">
<div class="contain">
<h1 class="site-title">
<a href="index.html"><img src="images/logo.png" alt="ロゴ"></a>
</h1>
<nav class="nav-sp">
<ul class="nav-menu">
<li><a href="#feature">特徴</a></li>
<li><a href="#course">コース案内</a></li>
<li><a href="#news">新着情報</a></li>
<li><a href="#access">アクセス</a></li>
</ul>
</nav>
<nav class="nav-pc">
<ul class="nav-menu">
<li><a href="#feature">特徴</a></li>
<li><a href="#course">コース案内</a></li>
<li><a href="#news">新着情報</a></li>
<li><a href="#access">アクセス</a></li>
<li><a href="tel:000-123-4567">TEL 000-123-4567</a></li>
</ul>
</nav>
<a class="application-btn" href="#">体験申し込み</a>
</div>
<div class="hamburger">
<span></span> <span></span> <span></span>
</div>
</header>
<!-- MAIN -->
<section id="mainvisual">
<div class="title">
<p class="first-line">「好き」が未来を</p>
<p class="second-line">連れてくる</p>
</div>
<div class="garland1"><img src="images/pop_garland1.png" alt=""></div>
<div class="ball"><img src="images/pop_ball.png" alt=""></div>
<div class="crayon"><img src="images/pop_crayon.png" alt=""></div>
</section>
<!-- side-btn -->
<div class="side-btn js-side-btn">
<a href="#">体験<br>申し込み</a>
</div>
<!--feature -->
<section id="feature" class="wrapper">
<h2>
<span class="section-title">
Kids-Uが選ばれる理由
</span>
</h2>
<ul class="feature-list">
<li>
<img src="images/features_choose.jpg" alt="男の子が体育をしている">
<h3 class="list-title">
知・スポーツ・芸術<br> の習い事が選び放題
</h3>
<p>テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキスト</p>
</li>
<li>
<img src="images/features_pace.jpg" alt="生き生きした表情の男の子">
<h3 class="list-title">
お子様の<br> ペースに合わせて
</h3>
<p>テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキスト</p>
</li>
<li>
<img src="images/features_building.jpg" alt="校舎">
<h3 class="list-title">
同じ建物内で<br> 全ての習い事を実施
</h3>
<p>テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキスト</p>
</li>
</ul>
<a class="application-btn" href="#">体験申し込み</a>
<!-- 波型境目 -->
<div class="wave-border">
<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"
preserveAspectRatio="none">
<path
d="M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z"
class="shape-fill"></path>
</svg>
</div>
<div class="sheep pc-pop"><img src="images/pop_sheep.png" alt=""></div>
<div class="penguin pc-pop"><img src="images/pop_penguin.png" alt=""></div>
</section>
<!-- course -->
<section id="course" class="wrapper">
<h2>
<span class="section-title">コース案内</span>
</h2>
<div class="course-list">
<div class="img">
<img src="images/programming.jpg" alt="プログラミング">
</div>
<div class="text">
<h3>
<span class="course-title">知育・学習コース</span>
</h3>
<p class="course-item">
英語・プログラミング・そろばん
</p>
<p class="course-text">
テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキスト
</p>
<a class="detail-btn" href="#">詳しく見る</a>
</div>
</div>
<div class="course-list">
<div class="img">
<img src="images/futsal.jpg" alt="フットサル">
</div>
<div class="text">
<h3>
<span class="course-title">体育・スポーツコース</span>
</h3>
<p class="course-item">
体操・フットサル・バレエ&新体操
</p>
<p class="course-text">
テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキスト
</p>
<a class="detail-btn" href="#">詳しく見る</a>
</div>
</div>
<div class="course-list">
<div class="img">
<img src="images/art.jpg" alt="絵画教室">
</div>
<div class="text">
<h3>
<span class="course-title">芸術・音楽コース</span>
</h3>
<p class="course-item">
絵画・習字・ピアノ&エレクトーン
</p>
<p class="course-text">
テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキスト
</p>
<a class="detail-btn" href="#">詳しく見る</a>
</div>
</div>
<!-- 波型境目 -->
<div class="wave-border">
<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"
preserveAspectRatio="none">
<path
d="M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z"
class="shape-fill"></path>
</svg>
</div>
<div class="garland2 pc-pop"><img src="images/pop_garland1.png" alt=""></div>
<div class="scrapbook pc-pop"><img src="images/pop_scrapbook.png" alt=""></div>
<div class="garland3 pc-pop"><img src="images/pop_garland1.png" alt=""></div>
<div class="gerbera pc-pop"><img src="images/pop_gerbera.png" alt=""></div>
<a class="application-btn" href="#">体験申し込み</a>
</section>
<!-- news -->
<section id="news">
<div class="box">
<h2>
<span class="section-title">新着情報</span>
</h2>
<dl>
<div class="news-list">
<a href="#news">
<p class="date">〇〇年〇月〇日</p>
<p class="news-text">6月1日~6日まで、施設の水道管工事の為臨時休業いたします。</p>
</a>
</div>
<div class="news-list">
<a href="#news">
<p class="date">〇〇年〇月〇日</p>
<p class="news-text">育児雑誌「みーて」に掲載されました。</p>
</a>
</div>
<div class="news-list">
<a href="#news">
<p class="date">〇〇年〇月〇日</p>
<p class="news-text">テキストテキストテキストテキストテキストテキストテキストテキスト</p>
</a>
</div>
<div class="news-list">
<a href="#news">
<p class="date">〇〇年〇月〇日</p>
<p class="news-text">テキストテキストテキストテキストテキストテキストテキストテキスト</p>
</a>
</div>
</dl>
<a class="more-btn" href="#">もっと見る</a>
</div>
<!-- 波型境目 -->
<div class="wave-border">
<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"
preserveAspectRatio="none">
<path
d="M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z"
class="shape-fill"></path>
</svg>
</div>
<div class="hamster pc-pop"><img src="images/pop_hamster.png" alt=""></div>
<div class="hyacinth pc-pop"><img src="images/pop_hyacinth.png" alt=""></div>
</section>
<!-- access -->
<section id="access" class="wrapper">
<h2>
<span class="section-title">アクセス</span>
</h2>
<div class="content">
<div class="information-text">
<p class="kana">幼児教室</p>
<p class="name">Kids-U</p>
<dl>
<dt>営業時間</dt>
<dd>平日 9:00~17:00(土日祝 9:00~19:00)</dd>
<dt>住所</dt>
<dd>〒123-4567 東京都小松区小松1-2-3</dd>
<dt>TEL</dt>
<dd>000-123-4567(FAX 123-456-8888)</dd>
<dt>E-mail</dt>
<dd>kidsuuu@freemail.com</dd>
<dt>駐車場有</dt>
<dd>※保護者様専用5台。満車の際はお近くの有料駐車場をご利用下さい。</dd>
</dl>
</div>
<div class="map">
<iframe
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3240.8330566915583!2d139.76451597623134!3d35.681112429979784!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x60188bfbd89f700b%3A0x277c49ba34ed38!2z5p2x5Lqs6aeF!5e0!3m2!1sja!2sjp!4v1718744341688!5m2!1sja!2sjp"
width="800" height="800" style="border:0;" allowfullscreen="" loading="lazy"
referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
</div>
<a class="btn" href="#">体験申し込み</a>
<div class="garland4 pc-pop"><img src="images/pop_garland1.png" alt=""></div>
<div class="slide pc-pop"><img src="images/pop_slide.png" alt=""></div>
</section>
<!-- footer -->
<footer class="footer">
<p>©Kids-U 2024</p>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="js/script.js"></script>
</body>
</html>CSS
@charset "UTF-8";
/* ■■■■■■■■ 共通事項 ■■■■■■■■*/
body {
font-family: 'Zen Maru Gothic', serif;
line-height: 1.5;
font-size: 100%;
color: #333;
background: #fafafa url('../images/kabegami.png');
background-size: 128px;
}
img {
width: 100%;
}
.wrapper {
margin-inline: auto;
padding: 40px 30px;
}
h2 {
text-align: center;
}
.section-title {
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 40px;
display: inline-block;
background-image: linear-gradient(transparent 70%, #ff6 70%);
padding-bottom: .25rem;
}
h3 {
font-size: 1.125rem;
font-weight: bold;
text-align: center;
}
.application-btn,
.nav-pc,
.pc-pop {
display: none;
}
.fa-solid {
color: #000;
font-size: 60px;
}
/* 波型境目 */
.wave-border {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
overflow: hidden;
line-height: 0;
transform: rotate(180deg);
}
.wave-border svg {
position: relative;
display: block;
width: calc(100% + 1.3px);
height: 40px;
}
.wave-border .shape-fill {
fill: #fff5e4;
}
/* ■■■■■■■■ header ■■■■■■■■*/
#header {
height: 60px;
padding: 10px;
}
.site-title {
width: 50px;
background-color: #fff;
border-radius: 20%;
}
.hamburger {
width: 40px;
height: 40px;
background: #ff8441;
position: fixed;
top: 10px;
right: 10px;
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
z-index: 30;
}
.hamburger:hover {
opacity: 0.7;
}
/* ハンバーガーの線(メニューが閉じているとき) */
.hamburger span {
width: 20px;
height: 2px;
background: #fff;
position: absolute;
left: 10px;
transition: 0.3s ease-in-out;
}
/* ハンバーガーの線(1・2・3本目) */
.hamburger span:nth-child(1) {
top: 11px;
}
.hamburger span:nth-child(2) {
top: 19px;
}
.hamburger span:nth-child(3) {
top: 27px;
}
/* ハンバーガーの線オープン時に×にする
1本目の線を―45度回転*/
.hamburger.active span:nth-child(1) {
top: 19px;
left: 10px;
background: #fff;
rotate: -45deg;
}
/* 2.3本目の線を重ねて45度回転 */
.hamburger.active span:nth-child(2),
.hamburger.active span:nth-child(3) {
top: 19px;
left: 10px;
background: #fff;
rotate: 45deg;
}
/* 最初は閉じている状態なので非表示にする */
.nav-sp {
width: 50%;
height: 100vh;
background-color: #ff8441;
color: #fff;
position: fixed;
top: 0;
right: 0;
z-index: 20;
opacity: 0;
text-align: center;
transition: opacity 0.6s ease, visibility 0.6s ease;
visibility: hidden;
}
/* ハンバーガーがクリックされた際に、.nav-spにactiveクラスを
追加してメニューを表示する */
.nav-sp.active {
opacity: 0.8;
visibility: visible;
}
.nav-sp ul.nav-menu {
margin: 110px 0 40px 0;
}
.nav-sp ul.nav-menu li {
margin-bottom: 20px;
}
/* ■■■■■■■■ main ■■■■■■■■*/
#mainvisual {
height: 80vh;
background-image: url(../images/top_pc.png);
background-size: cover;
background-position: center;
position: relative;
margin-bottom: 80px;
}
.title {
position: absolute;
bottom: 23%;
left: 5%;
font-size: 1.5rem;
font-weight: bold;
color: #fff;
width: 250px;
}
.first-line,
.second-line {
background-color: #46d3ff;
display: inline-block;
padding: 5px;
border-radius: 10px;
}
.second-line {
margin-left: 110px;
}
.garland1 {
position: absolute;
top: 55px;
right: 0;
rotate: 25deg;
width: 200px;
}
.ball {
position: absolute;
width: 60px;
bottom: -40px;
left: 30px;
}
.crayon {
position: absolute;
width: 90px;
bottom: -50px;
right: 30px;
}
/* ■■■■■■■■ サイドボタン ■■■■■■■■*/
.side-btn {
display: none;
width: 80px;
height: 70px;
position: fixed;
bottom: 10px;
right: 10px;
z-index: 10;
line-height: 1.3;
text-align: center;
opacity: 0.9;
}
.side-btn.is-active {
display: block;
}
.side-btn a {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background-color: #46d3ff;
color: #fff;
border-radius: 44px 40px 53px 35px / 50%;
}
/*footerまでスクロールしたら消す*/
.is-hidden {
visibility: hidden;
opacity: 0;
}
/* ■■■■■■■■ feature ■■■■■■■■*/
#feature {
position: relative;
background-color: #fff;
}
.feature-list li {
margin-bottom: 40px;
max-width: 300px;
margin-inline: auto;
}
.feature-list h3 {
margin-bottom: 10px;
}
.feature-list img {
display: block;
margin: 0 auto 10px;
;
width: 250px;
border-radius: 50%;
border: solid 10px #46d3ff;
}
/* ■■■■■■■■ course ■■■■■■■■*/
#course {
background-color: #fff5e4;
position: relative;
}
#course .wave-border {
transform: none;
bottom: -38px;
}
.course-list {
margin-bottom: 40px;
max-width: 540px;
margin-inline: auto;
}
.course-list:nth-of-type(3) {
margin-bottom: 20px;
}
.course-list img {
border-radius: 30px 30px 0 0;
}
.course-list .text {
border-radius: 0 0 30px 30px;
background-color: #fff;
padding: 20px;
}
.course-list .course-title {
display: inline-block;
margin-bottom: 20px;
border-bottom: solid 3px #46d3ff;
}
.course-list .course-item {
font-weight: bold;
text-align: center;
margin-bottom: 20px;
}
.course-list .course-text {
margin-bottom: 20px;
}
.detail-btn {
font-weight: bold;
display: block;
margin: auto;
width: 190px;
padding: 10px 40px;
background-color: #46d3ff;
border-radius: 50px;
color: #fff;
text-align: center;
border: 1px solid #46d3ff;
transition: 0.2s;
}
.detail-btn:hover {
color: #46d3ff;
background-color: #fff;
}
/* ■■■■■■■■ news ■■■■■■■■*/
#news {
position: relative;
padding: 70px 30px;
}
.box {
background-color: #fff;
padding: 40px 20px;
border: 3px solid #ff8441;
border-radius: 30px;
max-width: 540px;
margin-inline: auto;
}
.box dl {
margin-bottom: 40px;
}
.box dl .date {
font-weight: normal;
}
.news-list a:hover {
color: #46d3ff;
}
.box dl .news-list {
border-bottom: 1px solid #333;
padding-bottom: 20px;
margin-bottom: 20px;
}
.btn {
font-weight: bold;
display: block;
margin: auto;
width: 190px;
padding: 10px 40px;
background-color: #ff8441;
border-radius: 50px;
color: #fff;
text-align: center;
border: 1px solid #ff8441;
transition: 0.2s;
}
.btn:hover {
color: #ff8441;
background-color: #fff;
}
/* ■■■■■■■■ access ■■■■■■■■*/
#access {
background-color: #fff5e4;
padding: 40px 30px 80px;
}
.kana {
margin-bottom: -10px;
}
.name {
font-size: 2rem;
font-weight: bold;
margin-bottom: 20px;
}
#access dl dd {
margin-bottom: 5px;
}
.more-btn {
font-weight: bold;
display: block;
margin: auto;
width: 190px;
padding: 10px 40px;
background-color: #ff8441;
border-radius: 50px;
color: #fff;
text-align: center;
border: 1px solid #ff8441;
transition: 0.2s;
}
/* FontAwesome ===================*/
.detail-btn::after,
.more-btn::after {
font-family: "Font Awesome 6 free";
font-weight: 1000;
content: "\f0da";
color: #fff;
margin-left: 5px;
transition: 0.2s;
}
/* ============================== */
.more-btn:hover::after,
.more-btn:hover {
color: #ff8441;
background-color: #fff;
}
.detail-btn:hover:after {
color: #46d3ff;
background-color: #fff;
}
.information-text {
margin-bottom: 20px;
}
iframe {
width: 100%;
height: 200px;
}
#access .content {
margin-bottom: 40px;
}
/* ■■■■■■■■ footer ■■■■■■■■*/
.footer {
background-color: #ff8441;
}
.footer p {
color: #fff;
text-align: center;
padding: 13px 0;
}
/* 〇〇〇〇 PC 〇〇〇〇*/
/* ■■■■■■■■ 共通事項 ■■■■■■■■*/
@media screen and (960px <= width) {
.section-title {
font-size: 3rem;
margin-bottom: 80px;
}
h3 {
font-size: 1.5rem;
}
.nav-sp,
.hamburger,
.side-btn a {
display: none;
}
.nav-pc,
.application-btn,
.pc-pop {
display: block;
}
.site-title {
width: 80px;
}
.wrapper {
padding: 80px 40px;
}
/* ■■■■■■■■ header ■■■■■■■■*/
#header {
height: 100px;
}
.nav-menu {
display: flex;
justify-content: center;
font-size: 1.3rem;
font-weight: bold;
}
.nav-menu li {
padding-right: 30px;
}
.nav-menu li:last-child {
padding-right: 0;
}
.application-btn {
font-weight: bold;
display: block;
width: 190px;
padding: 10px 40px;
background-color: #ff8441;
border-radius: 50px;
color: #fff;
text-align: center;
border: 1px solid #ff8441;
transition: 0.2s;
}
.application-btn:hover {
color: #ff8441;
background-color: #fff;
}
.contain {
display: flex;
justify-content: space-around;
align-items: center;
max-width: 1200px;
margin-inline: auto;
}
/* ■■■■■■■■ main ■■■■■■■■*/
#mainvisual {
background-size: contain;
background-repeat: no-repeat;
}
.title {
font-size: 3rem;
width: 500px;
}
.second-line {
margin-left: 210px;
}
.garland1 {
width: 350px;
top: 80px;
left: 50%;
translate: 125px 0;
}
.ball {
width: 120px;
left: 50%;
translate: -410px 0;
}
.crayon {
width: 194px;
bottom: -55px;
left: 50%;
translate: 280px 0;
}
/* ■■■■■■■■ feature ■■■■■■■■*/
#feature {
position: relative;
}
.feature-list {
display: flex;
gap: 110px;
justify-content: center;
margin: 0 auto 40px;
}
.feature-list li {
width: 250px;
margin-inline: 0;
}
.sheep {
width: 150px;
position: absolute;
bottom: 50px;
left: 10%;
}
.penguin {
width: 160px;
position: absolute;
bottom: 32px;
right: 10%;
}
#feature .application-btn {
margin: auto;
font-size: 2.0rem;
width: 290px;
}
/* ■■■■■■■■ course ■■■■■■■■*/
#course {
position: relative;
}
.course-item {
font-size: 1.125rem;
}
.course-list {
max-width: 1280px;
display: flex;
justify-content: center;
margin-bottom: 60px;
}
.course-list:nth-of-type(2) {
flex-direction: row-reverse;
}
.course-list:nth-of-type(3) {
margin-bottom: 80px;
}
.course-list img {
position: relative;
border-radius: 30px;
box-shadow: 2px 2px 8px #a7a6a6;
}
.course-list .text {
border-radius: 30px;
width: 470px;
margin-top: 80px;
padding: 30px 60px;
}
.course-list:nth-of-type(odd) .text {
margin-left: -40px;
}
.course-list:nth-of-type(2) .text {
margin-right: -40px;
}
.garland2 {
position: absolute;
rotate: 28deg;
width: 350px;
top: 190px;
right: 5%;
transform-origin: top right;
}
.scrapbook {
position: absolute;
width: 230px;
top: 580px;
left: 5%;
}
.garland3 {
position: absolute;
rotate: -10deg;
width: 350px;
bottom: 140px;
left: 5%;
}
.gerbera {
position: absolute;
rotate: -20deg;
width: 200px;
top: 1045px;
right: 5%;
}
#course .application-btn {
margin: auto;
font-size: 2.0rem;
width: 290px;
}
/* ■■■■■■■■ news ■■■■■■■■*/
#news {
position: relative;
padding: 100px 40px;
}
.news-list a {
display: flex;
justify-content: space-between;
align-items: center
}
.box dl {
margin-bottom: 80px;
}
.news-list .date {
width: 30%;
}
.news-list .news-text {
width: 70%;
}
.box {
padding: 80px;
max-width: 700px;
margin: auto;
}
.hamster {
position: absolute;
width: 200px;
rotate: 20deg;
top: 70px;
right: 5%;
}
.hyacinth {
position: absolute;
rotate: -20deg;
width: 160px;
bottom: 70px;
left: 7%;
}
/* ■■■■■■■■ access ■■■■■■■■*/
#access {
position: relative;
padding: 80px 40px 160px;
}
#access .content {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 80px;
}
.name {
margin-bottom: 10px;
}
.information-text {
margin-bottom: 0;
font-size: 1.125rem;
width: 50%;
}
iframe {
height: 350px;
}
.map {
width: 50%;
}
.information-text dl {
display: flex;
flex-wrap: wrap;
}
.information-text dl dt {
width: 20%;
}
.information-text dl dd {
width: 70%;
}
#access .btn {
font-size: 2.0rem;
width: 290px;
}
.garland4 {
position: absolute;
rotate: 20deg;
width: 350px;
top: 80px;
right: 5%;
}
.slide {
position: absolute;
width: 230px;
bottom: 40px;
left: 5%;
}
/* ■■■■■■■■ footer ■■■■■■■■*/
.footer {
padding: 25px;
}
}
/* ■■■■■■■■ 1280px以上で以下の部分のみ仕様を変更 ■■■■■■■■*/
@media screen and (1280px <= width) {
.nav-menu {
font-size: 1.5rem;
}
#access .content {
width: 970px;
margin-inline: auto;
}
}
JS
$(function () {
/*=================================================
ハンバーガ―メニュー
===================================================*/
// ハンバーガーメニューをクリックした時
$('.hamburger').on('click', function () {
hamburger();
});
;
// ハンバーガーメニューのリンクをクリックしたとき
$('.nav-sp a').on('click', function () {
hamburger();
});
/*=================================================
ハンバーガ―メニュー共通処理
===================================================*/
function hamburger() {
$('.hamburger').toggleClass('active');
if ($('.hamburger').hasClass('active')) {
$('.nav-sp').addClass('active');
} else {
$('.nav-sp').removeClass('active');
}
}
/*=================================================
サイドボタン
===================================================*/
const $footer = $('footer');
const $trialBtn = $(".js-side-btn");
function checkScroll() {
const scrollTop = $(window).scrollTop();
const footerTop = $footer.offset().top;
const windowHeight = $(window).height();
if (scrollTop > 200) {
$trialBtn.stop().fadeIn();
} else {
$trialBtn.stop().fadeOut();
}
if (scrollTop + windowHeight >= footerTop) {
$trialBtn.stop().fadeOut();
}
}
$(window).on('scroll', checkScroll);
});解説
JSはドロワー(ハンバーガーメニュー)、右下の「体験お申し込み」ボタンの2カ所で使用しています。
任意で実装しましょう。
ボタンの矢印はFont AwesomeのCaret Rightを使用しています。
フォントはGoogle FontsのZen Maru Gothicです。
まずは、模写コーディングの準備を読んで準備をしましょう。そして、模写コーディングの手順を参考にしながら挑戦してみましょう。

