JSFiddle - React, Tailwind, and code Playground
by davidxmartins
HTML
<body>
<main id="butter" class="outer-wrapper">
<div class="wrapper">
<article class="section" id="a"><h2>01</h2></article>
<article class="section" id="b"><h2>02</h2></article>
<article class="section" id="c"><h2>03</h2></article>
<article class="section" id="d"><h2>04</h2></article>
<article class="section" id="e"><h2>05</h2></article>
<article class="section" id="f"><h2>06</h2></article>
</div>
</main>
<!-- MENU _____________________ -->
<header class="large">
<div class="container">
<nav>
<a href="#welcome"><div class="logo"></div></a>
<ul>
<li><a href="#a">01</a></li>
<li><a href="#b">02</a></li>
<li><a href="#c">03</a></li>
<li><a href="#d">04</a></li>
</ul>
</nav>
</div>
</header>
</body>
CSS
body {
margin: 0;
padding: 0;
}
.outer-wrapper {
width: auto;
height: 100vw;
transform: rotate(-90deg) translateX(-100vh);
transform-origin: top left;
overflow-y: scroll;
overflow-x: hidden;
position: absolute;
scrollbar-width: none;
-ms-overflow-style: none;
scroll-behavior: smooth;
}
::-webkit-scrollbar {
display: none;
}
.wrapper {
display: flex;
flex-direction: row;
width: auto;
transform: rotate(90deg) translateY(-100vh);
transform-origin: top left;
margin: 0;
padding: 0;
}
.section {
color: #000;
width: 100vw;
height: 100vh;
}
#a { background-color: #ccc; }
#b { background-color: #fff; }
#c { background-color: #ccc; }
#d { background-color: #fff; }
#e { background-color: #ccc; }
#f { background-color: #fff; }
h2 {
text-align: center;
font-size: 200px;
margin: 0;
}
/* MENU _________________________ */
.logo {
float: left;
}
nav {
width: 100%;
}
/* HEADER */
header {
float: left;
width: 100%;
position: absolute;
z-index: 9999;
}
/* HEADER LARGE */
header.large {
height: 50px;
}
header.large .logo {
width: 225px;
height: 50px;
margin: 20px 0 0 20px;
background: url('../images/logo-fireqa-green-500px.png');
background-repeat: no-repeat;
background-size: contain;
transition: 0.7s all;
-moz-transition: 0.7s all;
-webkit-transition: 0.7s all;
-o-transition: 0.7s all;
}
/* UNORDERED LIST */
header.large ul {
list-style: none;
float: right;
margin-right: 25px;
}
header.small ul {
list-style: none;
float: right;
margin: 0;
}
header.large li {
display: inline;
float: left;
list-style-position: inside;
height: 50px;
-webkit-transition: all ease 0.3s;
-moz-transition: all ease 0.3s;
transition: all 0.3s ease-in-out;
}
header.large li a {
display: block;
padding: 20px;
color: #0E6245;
text-decoration: none;
font-family: 'Montserrat', 'arial', sans-serif;
font-weight: 600 !important;
letter-spacing: -1px;
font-size: 25px;
...
JavaScript
// butter.js
(function(root){
var Butter = function() {
var self = this;
this.defaults = {
wrapperId: 'butter',
wrapperDamper: 0.07,
cancelOnTouch: false
}
this.validateOptions = function(ops) {
for (var prop in ops) {
if (self.defaults.hasOwnProperty(prop)) {
Object.defineProperty(self.defaults, prop, {value: Object.getOwnPropertyDescriptor(ops, prop).value})
}
}
}
this.wrapperDamper;
this.wrapperId;
this.cancelOnTouch;
this.wrapper;
this.wrapperOffset = 0;
this.animateId;
this.resizing = false;
this.active = false;
this.wrapperHeight;
this.bodyHeight;
};
Butter.prototype = {
init: function(options) {
if (options) {
this.validateOptions(options);
}
this.active = true;
this.resizing = false;
this.wrapperDamper = this.defaults.wrapperDamper;
this.wrapperId = this.defaults.wrapperId;
this.cancelOnTouch = this.defaults.cancelOnTouch;
this.wrapper = document.getElementById(this.wrapperId);
this.wrapper.style.position = 'fixed';
this.wrapper.style.width = '100%';
this.wrapperHeight = this.wrapper.clientHeight;
document.body.style.height = this.wrapperHeight + 'px';
window.addEventListener('resize', this.resize.bind(this));
if (this.cancelOnTouch) {
window.addEventListener('touchstart', this.cancel.bind(this));
}
this.wrapperOffset = document.documentElement.scrollTop || window.scrollY || 0.0;
this.animateId = window.requestAnimationFrame(this.animate.bind(this));
// window.addEventListener('load', this.resize.bind(this));
},
wrapperUpdate:...