JSFiddle - React, Tailwind, and code Playground
by Glynne Turner
HTML
<script src="https://code.jquery.com/jquery-3.4.1.slim.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css">
<div class="all-content">
<div class="navbar">
<div class="menu">
<h3 class="logo">Mayank<span>Rana</span></h3>
<div class="hamburger-menu">
<div class="bar"></div>
</div>
</div>
</div>
<div class="links" style="">
<ul>
<li>
<a href="a" style="--i: 0.05s;">Home</a>
</li>
<li>
<a href="b" style="--i: 0.1s;">Services</a>
</li>
<li>
<a href="c" style="--i: 0.15s;">Portfolio</a>
</li>
<li>
<a href="#" style="--i: 0.2s;">Testimonials</a>
</li>
<li>
<a href="#" style="--i: 0.25s;">About</a>
</li>
<li>
<a href="#" style="--i: 0.3s;">Contact</a>
</li>
</ul>
</div>
<div class="main-container">
<div class="main">
<header>
<div class="overlay">
<div class="inner">
<h2 class="title">Click on NavBar icon</h2>
<p>
In this project I try to make a 3D navbar animation you can check it out by clicking on the nav bar icon on ther top right corner.
</p>
<button class="btn">Read more</button>
</div>
</div>
</header>
</div>
</div>
</div>
<article>
<section class="container-fluid s1">
<div class="row">
<div class="col-12...
CSS
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap");
* {
padding: 0;
margin: 0;
box-sizing: border-box;
position:relative;
}
body,
button {
font-family: "Poppins", sans-serif;
}
body.freeze{overflow:hidden;}
body {
-ms-overflow-style: none; /* Internet Explorer 10+ */
scrollbar-width: none; /* Firefox */
background-image: linear-gradient(135deg, DarkGreen 0%, #023020 74%);
}
body::-webkit-scrollbar {
display: none; /* Safari and Chrome */
}
article{background:#fff}
.all-content {
min-height:100%;
width: 100%;
transform-style: preserve-3d;
-ms-overflow-style: none; /* Internet Explorer 10+ */
scrollbar-width: none; /* Firefox */
}
.all-content::-webkit-scrollbar {
display: none; /* Safari and Chrome */
}
.navbar {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 10;
height: 3rem;
}
.menu {
max-width: 72rem;
width: 100%;
margin: 0 auto;
padding: 0 2rem;
display: flex;
justify-content: space-between;
align-items: center;
color: #fff;
}
.hamburger-menu {
height: 4rem;
width: 3rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: flex-end;
}
.bar {
width: 1.9rem;
height: 1.5px;
border-radius: 2px;
background-color: #eee;
transition: 0.5s;
position: relative;
}
.bar:before,
.bar:after {
content: "";
position: absolute;
width: inherit;
height: inherit;
background-color: #eee;
transition: 0.5s;
}
.bar:before {
transform: translateY(-9px);
}
.bar:after {
transform: translateY(9px);
}
.main {
position: relative;
width: 100%;
left: 0;
z-index: 5;
transform-origin: left;
transform-style: preserve-3d;
transition: 0.5s;
}
header {
min-height: 100vh;
width: 100%;
background: url("https://i.postimg.cc/vHtXVqkr/bg.jpg") no-repeat top center / cover;
position: relative;
}
.overlay {
position: absolute;
width: 100%;
height:...
JavaScript
var hamburger_menu = $(".hamburger-menu");
var container = $(".all-content");
$(hamburger_menu).click(function(){
$(container).toggleClass("active");
$('section').toggle('freeze')
});