JSFiddle - React, Tailwind, and code Playground
by envira
HTML
<header>
<div class="top">
<div class="heading">
<h1>home</h1>
</div>
<a href="#" class="menu">Products</a> <!--active link from menu to be displayed here -->
</div>
</header>
<div class="drawer">
<nav>
<ul class="nav nav-tabs nav-stacked">
<li class="active"><a href="#">Products</a></li><!-- active link changes -->
<li><a href="#">Information</a></li>
<li><a href="#">History</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Orders Complete</a></li>
</ul>
</nav>
<div style="width:100%; border:1px solid red; height:300px;">
Content here
</div>
</div>
CSS
/* Experiment Specific Styles */
.top {
background: #212121;
color: #fff;
position: absolute;
left: 0;
top: 0;
right: 0;
z-index: 2;
overflow: hidden;
}
.drawer {
-webkit-transform: translate3d(0, -141px, 0);
-moz-transform: translate3d(0, -141px, 0);
-o-transform: translate3d(0, -141px, 0);
transform: translate3d(0, -141px, 0);
-webkit-transition:-webkit-transform 0.25s linear;
-moz-transition:-moz-transform 0.25s linear;
-o-transition:-o-transform 0.25s linear;
transition:transform 0.25s linear;
}
.drawer.active {
-webkit-transform: translate3d(0,129px,0);
-moz-transform: translate3d(0,129px,0);
-o-transform: translate3d(0,129px,0);
transform: translate3d(0,129px,0);
}
a.menu {
position: absolute;
z-index: 3;
border:1px solid white;
text-decoration: none;
top: 1.6em;
left: 35.6em;
color: #fff;
text-transform: uppercase;
font-size: 0.65em;
padding: 0.4em 0.7em;
border-radius: 4px;
}
a.menu span {
font-size:1.6em;
vertical-align: -0.15em;
}
nav ul {
list-style:none;
}
nav ul li a {
display: block;
text-decoration: none;
background: rgba(0,0,0,0.3);
color: white;
padding: 1em;
margin-bottom: 1px;
}
nav ul li.active {border-left:15px solid blue; color:black; background:#ddd;}
/* Fallbacks */
.no-csstransforms .top {
position: static;
}
.no-csstransforms .drawer nav {
display: none;
}
.no-csstransforms .drawer.active nav {
display: block;
}
@media all and (min-width: 30em) {
.experiment-number {
float: left;
margin-right: 0.9em;
border-right: 1px solid;
padding-right: 1em;
padding-left: 0.9em;
padding-bottom: 0.6em;
margin-bottom: 0;
}
.drawer {
-webkit-transform: translate3d(0, -197px, 0);
-moz-transform: translate3d(0, -197px, 0);
-o-transform: translate3d(0, -197px, 0);
transform: translate3d(0, -197px, 0);
}
.drawer.active {
-webkit-transform:translate3d(0,87px,0);
-moz-transform:translate3d(0,87px,0);
-o-transform:translate3d(0,87px,0);
transform:translate3d(0,87px,0);
}
h1...
JavaScript
//http://www.jordanm.co.uk/lab/topdrawer
$('.menu').click(function(e){
$('.drawer').toggleClass('active');
e.preventDefault();
});