Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="theme-color" content="black"/>
- <meta name="msapplication-TileColor" content="#da532c"/>
- <meta name="msapplication-navbutton-color" content="black"/>
- <meta name="apple-mobile-web-app-capable" content="yes"/>
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
- <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
- <title>Collapsible Menu</title>
- <style>
- *{
- box-sizing: border-box;
- margin:0; padding:0;
- outline: none;
- border: none;
- }
- body{
- background: rgb(251,244,234) url("");
- min-width: 100vw;
- max-width: 100vw;
- min-height: 100vh;
- position: relative;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: center;
- }
- #menu{
- position: absolute;
- z-index: 9999;
- top: 5px; left: 5px;
- height: 30px; width: 30px;
- overflow: visible;
- font: 12px Arial;
- }
- #menu .close{
- z-index: ;
- overflow: hidden;
- font: 35px Arial;
- height: 100%; width: 100%;
- background: pink;
- color: red;
- outline: 1px solid black;
- }
- #menu .holder{
- z-index: -1;
- position: absolute;
- top: 30px; left: 0px;
- height: 200px; width: 300px;
- }
- .holder .upper{
- position: absolute;
- top: -30px;
- height: 30px; width: 100%;
- outline: 1px solid black;
- background: white;
- }
- .holder .lower{
- height: 100%; width: 100%;
- outline: 1px solid black;
- background: white;
- }
- .center{
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .hidden{
- display: none;
- pointer-events: none;
- }
- </style>
- </head>
- <body>
- <div id="menu">
- <div class="close center">×</div>
- <div class="holder center">
- <div class="upper center">
- something here
- </div>
- <div class="lower center">
- something here
- </div>
- </div>
- </div>
- <script>
- let create= (x)=> document.createElement(x),
- select= (x,y=document)=> y.querySelector(x),
- selectAll= (x,y=document)=> y.querySelectorAll(x);
- function collapseMenu(){
- let close= select("#menu .close");
- let holder= select(".holder");
- close.onclick=()=>{
- holder.classList.toggle("hidden");
- };
- }
- collapseMenu();
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment