Home
Code Library
Templates
Contact Us
Slide-in Navbar
Date
: October 26, 2023
Developed By:
Paul Baretto
Features
1120 Lorem Ipsum park
Mumbai
Maharashtra 400001
+000-000-0000
Home
About
Portfolio
Team
View Source
HTML
CSS
JS
Links
HTML
Copy
<div class="navMain"> <header class="navwrapper"> <nav class="nav4"> <ul> <li><a href="#"><img class="header-logo" src="https://nuitwebtek.com/wp-content/uploads/2023/10/Logo.png" alt="Logo"></a></li> <li> <button class="navbtn"><i class="fa-solid fa-grip"></i></button> </li> </ul> </nav> <div class="navitems-container"> <div class="nb-items-wrapper"> <div class="nb-items nb-item-left"> <div class="nav4-left-holder"> <div class="nav4-features-container"> <a href="#"> <div class="nav4-left-inner-div-top"> <h2> Features</h2> </div> </a> </div> <div class="nav4-adds-logo-container"> <div class="nav4-adds"> <a href="#" class="nav4-address"> 1120 Lorem Ipsum park <br> Mumbai<br> Maharashtra 400001<br> +000-000-0000 </a> <div class="nav4-socail-icons"> <a href="#"><i class="fa-brands fa-instagram"></i></a> <a href="#"><i class="fa-brands fa-facebook"></i></a> <a href="#"><i class="fa-brands fa-x-twitter"></i></a> </div> </div> <div class="nav4-logo-only"> <a href="#"> <img src="https://nuitwebtek.com/wp-content/uploads/2023/10/Logo-black.png" alt="Logo"> </a> </div> </div> </div> </div> <div class="nb-items nb-item-right"> <nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Portfolio</a></li> <li><a href="#">Team</a></li> </ul> </nav> </div> </div> </div> </header> </div>
CSS
Copy
.navMain{ height: 100vh; width: 100%; background-color: #efefef; background-image: url(https://nuitwebtek.com/wp-content/uploads/2023/10/bg-img.jpg); background-repeat: no-repeat; background-size: cover; } .navwrapper{ font-family: 'Playfair Display', serif; --pri-color: #21A9E4; } .navwrapper a{ color: inherit; text-decoration: none; } .nav4{ position: relative; padding: 10px 20px; z-index: 1; } .header-logo{ transition: 0.3s linear; } .nav4 ul{ list-style: none; display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 0; } .nav4 ul li button{ outline: none; border: none; /* padding: 15px; */ background-color: #efefef; cursor: pointer; } .nav4 li button i{ font-size: 30px; color:#000; } .navwrapper .navitems-container{ position: absolute; top: 0; width: 100%; height: 100%; visibility: hidden; overflow:hidden; } .navitems-container.showNav4{ visibility: visible; } .nb-items-wrapper{ display: flex; width: 100%; height: 100%; } .nb-items-wrapper .nb-items{ width: 100%; height: 100%; } .nav4-left-holder{ width: 100%; height: 100%; display: grid; } .nav4-features-container, .nav4-adds-logo-container{ height: 100%; min-height: 240px; } .nav4-features-container{ transition: 0.6s linear; transform: translateX(-100%); } .showNav4 .nav4-features-container{ transform: translateX(0); } .nav4-features-container a { display: flex; width: 100%; height: 100%; align-items: end; justify-content: end; background-image: url(https://nuitwebtek.com/wp-content/uploads/2023/10/nav-item-bg.jpg) ; background-size: 100% 100%; } .nav4-left-inner-div-top{ padding-right:15px; padding-bottom:10px; } .nav4-left-inner-div-top h2{ margin: 0; font-size: 50px; color: #fff; font-family:inherit; } .nav4-adds-logo-container{ display: flex; } .nav4-adds-logo-container .nav4-adds, .nav4-adds-logo-container .nav4-logo-only{ width: 100%; height: 100%; } .nav4-adds-logo-container .nav4-adds{ background-image: url(https://nuitwebtek.com/wp-content/uploads/2023/10/adde-bg-img.png); background-size: 100% 100%; background-repeat: no-repeat; display: grid; align-items: end; transform: translateY(100%); transition: 0.5s linear; } .showNav4 .nav4-adds{ transform: translateX(0); } .nav4-adds a.nav4-address{ display: block; color: #fff; font-size: 25px; font-weight: 400; text-align: end; padding-right: 15px; } .nav4-adds-logo-container .nav4-socail-icons{ height: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; } .nav4-socail-icons a{ font-size: 40px; color: #fff; } .nav4-logo-only{ background-color: var(--pri-color); display: flex; justify-content: center; align-items: center; transition: 0.8s linear; /* transition-delay: 0.2s; */ transform: translateY(100%); } .showNav4 .nav4-logo-only { transform: translateX(0); } .nb-items.nb-item-right { background-color: #242424; transform: translateX(100%); transition: 0.5s ; /* transition-delay: 0.5s; */ } .showNav4 .nb-item-right { transform: translateX(0); } .nb-item-right nav{ width: 100%; height: 100%; display: flex; align-items: center; } .nb-item-right ul{ list-style: none; display: grid; gap: 50px; padding-left: 80px; } .nb-item-right ul li a{ font-size: 75px; font-family: inherit; font-weight: 400; color: #fff; } .nb-item-right ul li a:focus, .nb-item-right ul li a:active, .nb-item-right ul li a:hover{ color: var(--pri-color); } /* media querys */ @media only screen and (max-width:1020px){ .nb-items-wrapper{ flex-direction: column-reverse; } .nb-item-right nav{ justify-content: center; } .nb-item-right ul{ padding: 0; text-align: center; padding-top: 65px; } .nb-item-right ul li a{ font-size: 65px; } .nav4-features-container, .nav4-adds-logo-container { min-height: 300px; } /* .nav4-adds a.nav4-address{ font-size: 18px; } */ /* .nav4-socail-icons a{ font-size: 25px; } */ } @media only screen and (max-width:600px){ .navMain{ background-size:cover; } .nav4-features-container, .nav4-adds-logo-container { min-height: 240px; } .nb-item-right ul li a{ font-size:50px ; } .nav4-adds a.nav4-address{ font-size: 18px; padding-right: 8px; } .nav4-socail-icons a{ font-size: 25px; } .nav4-left-inner-div-top { padding-right: 10px; padding-bottom: 20px; } } /* below 480px */ @media only screen and (max-width:480px){ .nav4-features-container, .nav4-adds-logo-container{ min-height: 150px; } .nb-item-right ul li a{ font-size: 40px; } .nav4-features-container a{ background-size: cover; } .nav4-adds a.nav4-address{ font-size: 15px; } .nav4-socail-icons a { font-size: 20px; } }
JS
Copy
let headerLogo = document.querySelector('.header-logo'); console.log(headerLogo); let navContainer = document.querySelector('.navitems-container'); let navBtn = document.querySelector('.navbtn') // add class to nav-container on click on navBtn navBtn.addEventListener('click', () => { navContainer.classList.toggle('showNav4'); let icon = navBtn.querySelector('i'); icon.classList.toggle('fa-xmark') if(navContainer.classList.contains ('showNav4')){ headerLogo.style.cssText = 'transform:scale(0.8);'; }else{ headerLogo.style.cssText = 'transform:scale(1);'; } })
Links
Copy
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600&display=swap" rel="stylesheet"> <!-- font awosoem cdn --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
New
×