Created
February 6, 2025 08:40
-
-
Save anwerashif/c132dd90e2613f67890d2f7adc8fe7a6 to your computer and use it in GitHub Desktop.
Mobile Menu for Funnelish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="top-nav"> | |
<input id="menu-toggle" type="checkbox"> | |
<label class="menu-button-container" for="menu-toggle"> | |
<div class="menu-button"></div> | |
</label> | |
<ul class="menu"> | |
<li><a href="#">Track order</a></li> | |
<li><a href="#">Contact</a></li> | |
<li><a href="#">FAQ</a></li> | |
</ul> | |
<div class="menubgfull"></div> | |
</section> | |
<style> | |
.top-nav { | |
display: flex; | |
flex-direction: row-reverse; | |
align-items: center; | |
justify-content: space-between; | |
color: #000; | |
height: 40px; | |
position: relative; | |
z-index: 10; | |
background-color: #fff; | |
} | |
.top-nav #menu-toggle { | |
display: none; | |
z-index: 10; | |
} | |
.top-nav .menu-button-container { | |
display: flex; | |
height: 100%; | |
width: 30px; | |
cursor: pointer; | |
flex-direction: column; | |
justify-content: center; | |
align-items: center; | |
} | |
.top-nav .menu-button, | |
.top-nav .menu-button::before, | |
.top-nav .menu-button::after { | |
display: block; | |
background-color: #193239; | |
position: absolute; | |
height: 3px; | |
width: 30px; | |
transition: transform 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
border-radius: 2px; | |
} | |
.top-nav .menu-button::before { | |
content: ''; | |
margin-top: -8px; | |
} | |
.top-nav .menu-button::after { | |
content: ''; | |
margin-top: 8px; | |
} | |
.top-nav ul.menu { | |
position: absolute; | |
top: 60px; | |
right: 0px; | |
transform: translateX(20px); | |
width: 100vw; | |
display: flex; | |
flex-direction: column; | |
align-items: center; | |
list-style-type: none; | |
padding: 0; | |
margin: 0; | |
transition: max-height 0.4s ease-in-out; | |
z-index: 99999; | |
} | |
.top-nav #menu-toggle:checked ~ .menu li { | |
border: 1px solid #DEE5ED; | |
height: 3em; | |
padding: 10px; | |
transition: height 400ms cubic-bezier(0.23, 1, 0.32, 1); | |
display: flex; | |
justify-content: flex-start; | |
width: 100%; | |
color: white; | |
background-color: #ffffff; | |
overflow: hidden; | |
position: relative; | |
} | |
.top-nav #menu-toggle ~ .menu li { | |
margin: 0; | |
height: 0; | |
padding: 0; | |
border: 0; | |
/* transition: height 400ms cubic-bezier(0.23, 1, 0.32, 1); */ | |
display: flex; | |
justify-content: flex-start; | |
width: 100%; | |
color: white; | |
background-color: #fff; | |
overflow: hidden; | |
position: relative; | |
} | |
.top-nav .menu > li a { | |
color: #000; | |
font-size: 18px; | |
font-weight: bold; | |
} | |
.top-nav #menu-toggle:checked + .menu-button-container .menu-button::before { | |
margin-top: 0px; | |
transform: rotate(405deg); | |
} | |
.top-nav #menu-toggle:checked + .menu-button-container .menu-button::after { | |
margin-top: 0px; | |
transform: rotate(-405deg); | |
} | |
.top-nav #menu-toggle:checked + .menu-button-container .menu-button { | |
background: rgba(255, 255, 255, 0); | |
} | |
.top-nav #menu-toggle:checked ~ .menubgfull { | |
-webkit-backdrop-filter: blur(15px); | |
backdrop-filter: blur(15px); | |
width: 100vh; | |
height: 100vh; | |
position: fixed; | |
top: 140px; | |
left: 0; | |
right: 0; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment