JSFiddle - React, Tailwind, and code Playground
by Pallum
HTML
<header>
<nav>
<div class="mobile-nav">
<div class="nav-toggle"><i class="nav-icon"></i></div>
</div>
<ul class="left-nav">
<li class="home"><a href="#">Pixelation</a></li>
</ul>
<ul class="right-nav">
<li><a href="#">Work</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
CSS
* {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box; /* width and height value includes content, padding and border not the margin */
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0,0,0,0); /* remove highlight on touch devices */
-webkit-tap-highlight-color: transparent;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
html {
position: relative;
min-height: 100%; /* sticky footer */
overflow-y: scroll;
}
body {
font-family: "Helvetica Neue", helvetica, arial, sans-serif;
font-weight: normal;
font-size: 18px;
line-height: 1.2;
letter-spacing: 0.02em;
color: #000;
text-rendering: optimizelegibility !important;
}
b, strong {
font-weight: normal;
}
a:link, a:visited {
color: #000;
text-decoration: none;
}
/*a:hover, a:focus {
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}*/
h1, h2, nav a {
font-size: 18px;
font-weight: normal;
text-transform: uppercase;
text-align: center;
text-decoration: none;
margin: 0;
-webkit-column-span: all; /* break out the column flow */
column-span: all;
}
h1 {
margin: 0 0 24px 0;
}
p {
margin: 0 0 20px 0;
}
p:last-child {
margin-bottom: 0; /* remove bottom margin paragraph */
}
p a:link,
p a:visited {
color: #000;
text-decoration: underline;
}
p a:hover,
p a:focus {
color: #000;
}
.project-tag {
text-align: left;
}
.project-tag a:link {
text-decoration: none;
}
.project-tag a:hover {
color: grey;
}
/************************************************
Navigation
************************************************/
header {
position: absolute;
width: 100%;
top: 0;
left: 0;
margin: 0;
padding: 0;
z-index: 9999;
background-color: grey;
}
.mobile-nav {
display: none; /* hide mobile nav */
}
nav ul.left-nav {
float: left;
}
nav ul.right-nav {
float:...
JavaScript
// Navigation //
$(function() {
$('.nav-toggle').click(function() {
event.preventDefault();
$('nav ul.right-nav').slideFadeToggle(300);
$('.nav-toggle').toggleClass('is-active');
})
});
$(window).scroll(function() {
if ($(this).scrollTop() > 50) {
$('nav ul.right-nav').hide();
$('.nav-toggle').removeClass('is-active');
}
});
$.fn.slideFadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};