JSFiddle - React, Tailwind, and code Playground
by huppen
HTML
<div class="head">
Menu web design.
</div>
<div class="toggle">toggle</div>
<p></p>
<div class="foot">
Copyright web design.
</div>
CSS
.head,
.foot {
position: fixed;
width: 100%;
z-index: 100;
text-align: center;
font-size: 18px;
color: #000;
background: #FFF;
right: 0;
left: 0;
margin-right: auto;
margin-left: auto;
height: 50vh;
}
.head {
top: 0;
}
.foot {
bottom: 0;
}
.toggle {
position: relative;
z-index: 1001;
}
JavaScript
//Slide divs top/bottom
$(document).ready(function(){
$(".toggle,.head,.foot").click(function(){
if($(".foot").css('bottom') == '0px'){
$(".foot").animate({bottom:'-50vh'},1000);
}
else
{
$(".foot").animate({bottom:'0px'},1000);
}
if($(".head").css('top') == '0px'){
$(".head").animate({top:'-50vh'},1000);
}
else
{
$(".head").animate({top:'0px'},1000);
}
});
});