JSFiddle - React, Tailwind, and code Playground

by majikarikeruo

HTML

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Your Portfolio Web</title>
    <meta name="description" content="Your NameのポートフォリオWebサイトです。プロフィール掲載・制作してきた作品の紹介などをしています。">
    <meta property="og:title" content="Your Name Portfolio Site">
    <meta property="og:type" content="website">
    <meta property="og:url" content="#">
    <meta property="og:image" content="images/meta/ogimage.png">
    <meta property="og:site_name" content="Your Name Portfolio Site">
    <meta property="og:description" content="Your Name のPortfolio Siteです。">
    <link rel="apple-touch-icon" href="images/meta/apple-touch-icon.png">
    <link rel="icon" href="images/meta/icon.png">
    <link rel="shortcut icon" href="images/meta/favicon.ico">

    <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700" rel="stylesheet">

</head>
<body>

    <!-- hero-image -->
    <div class="hero-image">
        <ul class="bxslider">
            <li class="hero-image__eyecatch"><img src="images/header/bg-image.jpg" alt=""></li>
            <li class="hero-image__eyecatch"><img src="images/header/bg-image.jpg" alt=""></li>
        </ul>
        <p class="hero-image__text">Hello, World!!</p>
    </div>
    <!-- // hero-image -->

    <header class="header"> 
        <div class="wrapper header-wrapper">
            <h1 class="site-title">YOUR NAME Portfolio Web</h1>
            <nav class="nav">
                <ul class="nav-list">
                    <li class="nav-item"><a href="#about">About</a></li>
                    <li class="nav-item"><a href="#works">Works</a></li>
                    <li class="nav-item"><a href="#contact">Contact</a></li>
                </ul>
            </nav>
            <button class="btn-trigger">
                <svg viewBox="0 0 44 44" xmlns:xlink="http://www.w3.org/1999/xlink" role="img"...

CSS

@charset "UTF-8";

html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
	margin:0;
	padding:0;
	border:0;
	outline:0;
	font-size:100%;
	vertical-align:baseline;
	background:transparent;
	font-weight: normal;
}
img {
    margin:0;
    padding:0;
    border:0;
    outline:0;
    font-size:100%;
    vertical-align:bottom;
    background:transparent;
	} 
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}

ol, ul {
	list-style: none;
}

blockquote, q {
    quotes:none;
}

a {
    margin:0;
    padding:0;
    font-size:100%;
    vertical-align:baseline;
    background:transparent;
	text-decoration:none;
}

ins {
    background-color:#ff9;
    color:#000;
    text-decoration:none;
}

.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
 
.clearfix {
    display: inline-table;
    min-height: 1%;
}
 
.clear {
	clear:both;
}

@charset "utf-8";
html{
    font-size: 62.5%;
}
body{
    color: #333333;
    font-size: 1.6rem;
    font-family:"Open Sans",'ヒラギノ角ゴ ProN W3', Hiragino Kaku Gothic ProN, "メイリオ", Meiryo, sans-serif;
    background: #fff;
}
a{
    color: #333333;
    text-decoration:none;
}
p{
    line-height: 1.75;
}
a:hover{
    transition:all 0.5s;
}
img{
    max-width: 100%;
    height: auto;
}
.text-center{
  ...

JavaScript

/*-------------------------
スクロールして途中で固定 PCのみ
(トップページのみ)
(animationはCSSで定義してJSで発火)
--------------------------*/
$(window).on("load scroll",function(e){
  const $main = $(".main");
  const $homeHeader = $(".header");
  const $distance = $main.offset().top;
  const $scrollVal = $(window).scrollTop();
  const $navH = $(".header").outerHeight();

  if($scrollVal > $distance){
    $homeHeader.addClass("fix");
    $main.css("margin-top", $navH);
  }else{
    $homeHeader.removeClass("fix");
    $main.css("margin-top",0); 
  }
});