JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Japan Connections</title>
<link rel="stylesheet" href="styles.css" />
<!-- viewport 読み込み -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://fonts.googleapis.com/css?family=Julius+Sans+One" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/css/swiper.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/js/swiper.min.js"></script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
</head>
<body>
<div class="container">
<div id="globalNavi">
<h1 class="jc">Japan <span id="sun">●</span> Connections</h1>
<nav class="menu">
<ul class="menulist">
<li><a href="">HOME</a></li>
<li><a href="">ABOUT US</a></li>
<li><a href="">SERVICES</a></li>
<li><a href="">CONTACT</a></li>
</ul>
</nav>
</div>
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide" style="background-image: url('https://placehold.jp/24/99cc99/339933/350x150.png?text=img/1.jpg');">
Bringing the best of Japan to the World
</div>
<div class="swiper-slide" style="background-image: url('https://placehold.jp/24/99cc99/339933/350x150.png?text=img/2.jpg');">
Bringing the best of Japan to the World
</div>
<div class="swiper-slide" style="background-image: url('https://placehold.jp/24/99cc99/339933/350x150.png?text=img/3.jpg');">
Bringing the best of Japan to the World
</div>
<div class="swiper-slide" style="background-image:...
CSS
@charset "UTF-8";
body,
div,
p,
h1,
h2,
h3,
h4,
h5 {
margin: 0;
padding: 0;
font-family: 'Source Sans Pro', sans-serif;
line-height: 1.7;
letter-spacing: 0.05em;
}
/*
* header
*/
#globalNavi {
color: #000000;
width: 100%;
height: 130px;
padding: 20px 10px 10px 50px;
/* 変更しない */
}
#globalNavi h1 {
font-family: 'Julius Sans One', sans-serif;
font-size: 2.5em;
float: left;
}
span#sun {
color: red;
font-size: 1.5em;
}
.menu {
font-family: 'Julius Sans One', sans-serif;
}
.fixed {
position: fixed;
top: 0;
background-color: #fff;
width: 100%;
height: 130px;
z-index: 10000;
}
nav {
text-align: center;
position: relative;
left: 70px;
top: 17px;
}
ul {
list-style: none;
display: flex;
flex-flow: row;
flex-wrap: nowrap;
padding: 0 0 10px 0;
}
ul a {
padding: 12px 24px;
text-decoration: none;
padding-bottom: 5px;
color: #000;
display: block;
position: relative;
}
ul a:before {
content: '';
width: 0;
left: 50%;
bottom: 0;
transition: all 0.4s ease;
border-bottom: 1px solid red;
position: absolute;
display: block;
}
ul a:hover:before {
width: 50%;
border-bottom: 1px solid red;
}
ul a:after {
content: '';
width: 0;
right: 50%;
bottom: 0;
transition: all 0.4s ease;
border-bottom: 1px solid red;
position: absolute;
display: block;
}
ul a:hover:after {
width: 50%;
border-bottom: 1px solid red;
}
/*
Swiper
*/
.swiper-container {
width: 100%;
height: 400px;
}
.swiper-slide {
padding-top: 180px;
/* 画像位置の調整用 */
text-align: center;
color: #fff;
font-size: 30px;
background-repeat: no-repeat;
width: 1261px;
background-size: cover;
background-position: center center;
"
}
/*
* main & sidebar (wrapper)
*/
.container {
padding-left: -15px;
padding-right: 15px;
}
.main {
position: relative;
top: 50px;
left: 255px;
width: 800px;
margin: 0;
}
/*
Index
*/
.index-1 {
margin: 0;
/* デフォルトCSS打ち消し */
font-size: 24px;
/*...
JavaScript
var mySwiper = new Swiper('.swiper-container', {
loop: true,
pagination: '.swiper-pagination',
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
speed: 3000,
autoplay: {
delay: 3000, // スライドが切り替わるまでの表示時間(ミリ秒)
stopOnLast: false, // 最後のスライドまで表示されたら自動再生を中止するか
disableOnInteraction: true // ユーザーのスワイプ操作を検出したら自動再生を中止するか
},
});
jQuery(function($) {
var nav = $('#globalNavi'),
offset = nav.offset();
$(window).scroll(function() {
if ($(window).scrollTop() > offset.top) {
nav.addClass('fixed');
} else {
nav.removeClass('fixed');
}
});
});