webサイトデザインAI入門科授業用ブログ

池袋フェリカテクニカルアカデミーの求職者支援訓練の授業解説ブログです。

シングルページのカフェサイト(6月18日)のデータ

single-pageに入れるjqueryプラグイン
・bxslider(fade)
Lightbox
使用するAPI
google form(自動返信機能付き)、twitterfacebook
自身で実装するjquery
・スムーススクロール、タブパネル、ajax
別途記載するもの
css変数を使用してカラーマネジメント
・ロゴデータをsvg形式で使用
・セクショニングを意識したマークアップ



<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>シングルページのカフェサイト</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/jquery.bxslider.css">
</head>
<body>
<header>
<h1>ロゴ</h1>
<div class="main-visual">
<ul class="bxslider">
<li><img src="img/main01.jpg" alt=""></li>
<li><img src="img/main02.jpg" alt=""></li>
<li><img src="img/main03.jpg" alt=""></li>
</ul>
</div>
</header>
<nav id="g-nav">
<ul>
<li><a href="#">Top</a></li>
<li><a href="#video">Video</a></li>
<li><a href="#menu">Menu</a></li>
<li><a href="#gallery">Gallery</a></li>
<li><a href="#info">Info</a></li>
<li><a href="#form">Form</a></li>
</ul>
</nav>
<main>
<section>
<h2>News</h2>
<dl id="news-list">

</dl>
</section>

<section id="video">
<h2>Video</h2>
</section>

<section id="menu">
<h2>Menu</h2>
</section>

<section id="gallery">
<h2>Gallery</h2>
</section>

<section id="info">
<h2>Info</h2>
</section>

<section id="form">
<h2>Form</h2>
</section>
</main>
<footer>
</footer>




<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="js/jquery.bxslider.js"></script>
<script>
$(document).ready(function(){
  $('.bxslider').bxSlider({
  mode:"fade",
  auto: true,
  pager: false,
  controls: false,
  speed: 3000,
  pause: 3000
  });
});
</script>

<script>
$('#news-list').load('list.txt');
</script>

</body>
</html>


style.css

@charset "utf-8";

:root{
--main-color:#AA1744;
}


html{box-sizing:border-box;-webkit-text-size-adjust:100%}*,:after,:before{background-repeat:no-repeat;box-sizing:inherit}:after,:before{text-decoration:inherit;vertical-align:inherit}*{padding:0;margin:0}audio:not([controls]){display:none;height:0}hr{overflow:visible}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}summary{display:list-item}small{font-size:80%}[hidden],template{display:none}abbr[title]{border-bottom:1px dotted;text-decoration:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}code,kbd,pre,samp{font-family:monospace,monospace}b,strong{font-weight:bolder}dfn{font-style:italic}mark{background-color:#ff0;color:#000}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}input{border-radius:0}[role=button],[type=button],[type=reset],[type=submit],button{cursor:pointer}[disabled]{cursor:default}[type=number]{width:auto}[type=search]{-webkit-appearance:textfield}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}textarea{overflow:auto;resize:vertical}button,input,optgroup,select,textarea{font:inherit}optgroup{font-weight:700}button{overflow:visible}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:0;padding:0}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button:-moz-focusring{outline:1px dotted ButtonText}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}button,select{text-transform:none}button,input,select,textarea{background-color:transparent;border-style:none;color:inherit}select{-moz-appearance:none;-webkit-appearance:none}select::-ms-expand{display:none}select::-ms-value{color:currentColor}legend{border:0;color:inherit;display:table;max-width:100%;white-space:normal}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}img{border-style:none;vertical-align: bottom}progress{vertical-align:baseline}svg:not(:root){overflow:hidden}audio,canvas,progress,video{display:inline-block}@media screen{[hidden~=screen]{display:inherit}[hidden~=screen]:not(:active):not(:focus):not(:target){position:absolute!important;clip:rect(0 0 0 0)!important}}[aria-busy=true]{cursor:progress}[aria-controls]{cursor:pointer}[aria-disabled]{cursor:default}::-moz-selection{background-color:#b3d4fc;color:#000;text-shadow:none}::selection{background-color:#b3d4fc;color:#000;text-shadow:none}ul,ol{list-style:none;}a{text-decoration:none;}.wrapper{overflow:hidden;}body{overflow-y:scroll;}

header{
width: 100%;
height: calc(100vh - 50px);
position: relative;
}
h1{
width: 400px;
height: 300px;
background: url(../img/logo.svg)no-repeat center center/contain;
white-space: nowrap;
text-indent: 100%;
overflow: hidden;
position: absolute;
top: 50px;
right: 100px;
z-index: 3000;
}
.main-visual{
width: 100%;
height: 100%;
}
.main-visual li{
width: 100%;
height: calc(100vh - 50px);/* fadeの場合はimgの親要素に直接高さを指定する */
}
.main-visual img{
object-fit: cover;
width: 100%;
height: 100%;
}
#g-nav{
background-color: #FFF;
width: 100%;
height: 50px;
position: sticky;
top: 0;
}
#g-nav>ul{
display: flex;
justify-content: center;
height: 50px;
align-items: center;
}
#g-nav li{
margin: 0 30px;
}
#g-nav a{
color: var(--main-color);
padding: 4px 12px;
font-weight: bold;
}
section{
width: 100%;
padding-top: 100px;
height: 100vh;/* 必ず最後には消す */
}
section>h2{
color: var(--main-color);
text-align: center;
font-size: 30px;
margin-bottom: 50px;
}
/* news部分 */
#news-list{
max-width: 600px;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
}
#news-list>dt{
width: 30%;
color: var(--main-color);
font-weight: bold;
margin-bottom: 30px;
border-bottom: 2px solid var(--main-color);
padding-bottom: 6px;
display: none;
}
#news-list>dd{
width: 70%;
margin-bottom: 30px;
border-bottom: 2px solid var(--main-color);
padding-bottom: 6px;
display: none;
}
#news-list>dt:nth-of-type(-n+3),#news-list>dd:nth-of-type(-n+3){
display: block;
}