JSFiddle - React, Tailwind, and code Playground
HTML
<div class="box" id="box">
<h1>Content Behind the Main Page</h1>
</div>
<div id="page">
<h1>Pull Down Page Demo</h1>
<p onclick="doMove()">Click here to Open</p>
<p onclick="doMoveb()">Click here to Close</p>
<script>
function doMove() {
var element = document.getElementById("page");
element.classList.remove("move");
element.classList.remove("moveb");
element.classList.add("move");
}
function doMoveb() {
var element = document.getElementById("page");
element.classList.remove("move");
element.classList.remove("moveb");
element.classList.add("moveb");
}
</script>
CSS
#page {
z-index: 999;
width:100%;
height:100%;
background-color:white;
position:fixed;
top:0;
left: 0;
-webkit-transition: all .5s ease;
}
.box {
position:fixed;
top:0;
left: 0;
height:100%;
background-image: linear-gradient(#ddd, #ccc);
width: 100%;
display: block;
z-index:1;
}
.move {
top: 0em;
margin-top:10em;
}
.moveb {
top: 0em;
margin-top:0em;
}
h1 {
text-align: center;
font-size: 24px;
}