The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Below is the html code for this video.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Circular Menu</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="menu">
<div class="btn hamburger">
<span class="line"></span>
</div>
<div>
<div class="rotator">
<div class="btn btn-icon">
<a href="#home" class="link">Home</a>
</div>
</div>
<div class="rotator">
<div class="btn btn-icon">
<a href="#about" class="link">About</a>
</div>
</div>
<div class="rotator">
<div class="btn btn-icon">
<a href="#features" class="link">Features</a>
</div>
</div>
<div class="rotator">
<div class="btn btn-icon">
<a href="#contact" class="link">Contact</a>
</div>
</div>
<div class="rotator">
<div class="btn btn-icon">
<a href="#login" class="link">Login</a>
</div>
</div>
</div>
</div>
<script src="index.js"></script>
</body>
</html>
Below is the css code for this video.
style.css
*, *::after, *::before {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
width: 100%;
background: #808080;
overflow: hidden;
}
.menu, .menu .btn .link, .menu .btn.hamburger .line {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.menu {
width: 80px;
height: 80px;
}
.menu .btn {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
transform: translateX(0);
background: #dbd7d2;
border-radius: 50%;
opacity: 0;
z-index: -10;
transition: all 0.5s ease;
cursor: pointer;
}
.menu .btn:hover {
background: #16161d;
}
.menu .btn.hamburger {
transform: scale(1);
opacity: 1;
z-index: 10;
transition: all 0.5s ease;
cursor: pointer;
}
.menu .btn.hamburger:hover {
transform: scale(1.25);
}
.menu .btn.hamburger .line {
height: 8px;
width: 60%;
background: #16161d;
border-radius: 8px;
transition: all 0.5s ease;
}
.menu .btn.hamburger:hover .line {
background: #dbd7d2;
}
.menu .btn.hamburger .line::before, .menu .btn.hamburger .line::after {
content: "";
position: absolute;
left: 0;
display: block;
height: 8px;
width: 100%;
background: #16161d;
border-radius: 8px;
transition: all 0.5s ease;
}
.menu .btn.hamburger .line::before {
top: -16px;
transform-origin: 10% 100%;
}
.menu .btn.hamburger .line::after {
top: 16px;
transform-origin: 15% 30%;
}
.menu .btn.hamburger:hover .line::before, .menu .btn.hamburger:hover .line::after {
background: #dbd7d2;
}
.menu.active .hamburger .line {
top: 45%;
height: 0;
}
.menu.active .hamburger .line::before {
width: 110%;
transform: rotate(45deg);
}
.menu.active .hamburger .line::after {
width: 110%;
transform: rotate(-45deg);
}
.menu .rotator {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
transform-origin: 50% 50%;
}
.menu .btn .link {
color: #16161d;
font-size: 16px;
text-decoration: none;
transition: all 0.5s ease;
}
.menu .btn:hover .link {
color: #ebf6f7;
font-size: 24px;
}
.menu.active .btn-icon {
height: 80px;
width: 80px;
background: #ebf6f7;
opacity: 1;
z-index: 5;
transition: all 0.5s ease;
}
.menu.active .btn-icon:hover {
height: 100px;
width: 100px;
background: #16161d;
}
.rotator:nth-child(1) {
transform: rotate(-36deg);
}
.menu.active .rotator:nth-child(1) .btn-icon {
transform: translateY(-160px) rotate(36deg);
}
.rotator:nth-child(2) {
transform: rotate(36deg);
}
.menu.active .rotator:nth-child(2) .btn-icon {
transform: translateY(-160px) rotate(-36deg);
}
.rotator:nth-child(3) {
transform: rotate(108deg);
}
.menu.active .rotator:nth-child(3) .btn-icon {
transform: translateY(-160px) rotate(-108deg);
}
.rotator:nth-child(4) {
transform: rotate(180deg);
}
.menu.active .rotator:nth-child(4) .btn-icon {
transform: translateY(-160px) rotate(-180deg);
}
.rotator:nth-child(5) {
transform: rotate(252deg);
}
.menu.active .rotator:nth-child(5) .btn-icon {
transform: translateY(-160px) rotate(-252deg);
}
Below is the javascript code for this video.
index.js
const hamburger = document.getElementsByClassName("hamburger");
const menu = document.getElementsByClassName("menu");
hamburger[0].addEventListener("click", function () {
menu[0].classList.contains("active") ? menu[0].classList.remove("active") : menu[0].classList.add("active");
});
Thanks for visiting