<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>CodePen - Menu Button Interaction</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="./style.css">
</head>
<body>
<!-- partial:index.partial.html -->
<div class="list-container">
<button class="more-button" aria-label="Menu Button">
<div class="menu-icon-wrapper">
<div class="menu-icon-line half first"></div>
<div class="menu-icon-line"></div>
<div class="menu-icon-line half last"></div>
</div>
</button>
<ul class="more-button-list">
<li class="more-button-list-item">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings">
<circle cx="12" cy="12" r="3"/>
<path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"/>
</svg>
<span>Settings</span>
</li>
<li class="more-button-list-item">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-copy">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/>
</svg>
<span>Copy</span>
</li>
<li class="more-button-list-item">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-share">
<path d="M4 12v8a2 2 0 002 2h12a2 2 0 002-2v-8M16 6l-4-4-4 4M12 2v13"/>
</svg>
<span>Share</span>
</li>
<li class="more-button-list-item">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2">
<path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2M10 11v6M14 11v6"/>
</svg>
<span>Delete</span>
</li>
</d>
</div>
<div class="socials">
<a class="social-link" href="https://twitter.com/aybukeceylan" target="_top">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-twitter">
<path d="M23 3a10.9 10.9 0 01-3.14 1.53 4.48 4.48 0 00-7.86 3v1A10.66 10.66 0 013 4s-4 9 5 13a11.64 11.64 0 01-7 2c9 5 20 0 20-11.5a4.5 4.5 0 00-.08-.83A7.72 7.72 0 0023 3z"/>
</svg>
</a>
<a class="social-link" href="https://www.linkedin.com/in/ayb%C3%BCkeceylan/" target="_top">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-linkedin"><path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z"/><rect x="2" y="9" width="4" height="12"/><circle cx="4" cy="4" r="2"/></svg>
</a>
</div>
<!-- partial -->
<script src="./script.js"></script>
</body>
</html>
@import url("https://fonts.googleapis.com/css2?family=Montserrat&display=swap");
* {
box-sizing: border-box;
}
body {
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background-color: #84a0f4;
background-image: linear-gradient(to top, #84a0f4 0%, #c2e9fb 100%);
font-family: "Montserrat", sans-serif;
}
.list-container {
position: relative;
}
.list-container.active .more-button-list {
opacity: 1;
transform: scale(1);
}
.list-container.active .more-button-list-item {
-webkit-animation: fadeInItem 0.6s 0.2s forwards;
animation: fadeInItem 0.6s 0.2s forwards;
}
.list-container.active .more-button-list-item:nth-child(2) {
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.list-container.active .more-button-list-item:nth-child(3) {
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
}
.list-container.active .more-button-list-item:nth-child(4) {
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
.list-container.active .more-button {
-webkit-animation: onePulse 0.6s forwards linear;
animation: onePulse 0.6s forwards linear;
}
.list-container.active .menu-icon-wrapper {
transform: rotate(-45deg);
}
.list-container.active .menu-icon-line.first {
transform: rotate(-90deg) translateX(1px);
}
.list-container.active .menu-icon-line.last {
transform: rotate(-90deg) translateX(-1px);
}
.more-button {
background-color: #5c67ff;
box-shadow: 0px 0px 0px 4px rgba(92, 103, 255, 0.3);
border-radius: 50%;
width: 50px;
height: 50px;
border: none;
padding: 0;
cursor: pointer;
transition: 0.2s ease-in;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
position: relative;
z-index: 2;
}
.more-button:hover, .more-button:focus {
box-shadow: 0px 0px 0px 8px rgba(92, 103, 255, 0.3);
background-color: #4854ff;
}
.more-button:focus {
outline: 0;
}
.more-button-list {
background-color: #fff;
border-radius: 8px;
list-style-type: none;
width: 140px;
height: 170px;
box-shadow: 0px 0px 4px 4px rgba(150, 157, 249, 0.16);
padding: 0;
padding: 6px;
position: absolute;
right: 24px;
bottom: 0;
opacity: 0;
transform: scale(0);
transform-origin: bottom right;
transition: all 0.3s ease 0.1s;
}
.more-button-list li {
opacity: 0;
}
.more-button-list-item {
display: flex;
align-items: center;
color: #1c3991;
padding: 10px;
border-radius: 4px;
cursor: pointer;
position: relative;
transition: 0.2s ease-in;
transform: translatex(-10px);
}
.more-button-list-item:hover {
color: #5c67ff;
}
.more-button-list-item:after {
content: "";
position: absolute;
height: 1px;
width: calc(100% - 24px);
left: 12px;
bottom: 0;
background-color: rgba(132, 160, 244, 0.1);
}
.more-button-list-item:last-child:after {
display: none;
}
.more-button-list-item svg {
width: 18px;
height: 18px;
}
.more-button-list-item span {
display: inline-block;
line-height: 20px;
font-size: 14px;
margin-left: 8px;
}
@-webkit-keyframes onePulse {
0% {
box-shadow: 0px 0px 0px 0px rgba(92, 103, 255, 0.3);
}
50% {
box-shadow: 0px 0px 0px 12px rgba(92, 103, 255, 0.1);
}
100% {
box-shadow: 0px 0px 0px 4px rgba(92, 103, 255, 0.3);
}
}
@keyframes onePulse {
0% {
box-shadow: 0px 0px 0px 0px rgba(92, 103, 255, 0.3);
}
50% {
box-shadow: 0px 0px 0px 12px rgba(92, 103, 255, 0.1);
}
100% {
box-shadow: 0px 0px 0px 4px rgba(92, 103, 255, 0.3);
}
}
@-webkit-keyframes fadeInItem {
100% {
transform: translatex(0px);
opacity: 1;
}
}
@keyframes fadeInItem {
100% {
transform: translatex(0px);
opacity: 1;
}
}
.socials {
position: fixed;
bottom: 16px;
right: 16px;
display: flex;
align-items: center;
}
.social-link {
color: #fff;
display: flex;
align-items: center;
cursor: pointer;
text-decoration: none;
margin-right: 12px;
}
.menu-icon-wrapper {
border-radius: 2px;
width: 20px;
height: 20px;
display: flex;
flex-direction: column;
justify-content: space-between;
cursor: pointer;
transition: transform 330ms ease-out;
}
.menu-icon-line {
background-color: #fff;
border-radius: 2px;
width: 100%;
height: 2px;
}
.menu-icon-line.half {
width: 50%;
}
.menu-icon-line.first {
transition: transform 300ms cubic-bezier(0.52, -0.8, 0.52, 0.52);
transform-origin: right;
}
.menu-icon-line.last {
align-self: flex-end;
transition: transform 300ms cubic-bezier(0.52, -0.8, 0.52, 0.52);
transform-origin: left;
}
document.querySelector('.more-button').addEventListener('click', function () {
document.querySelector('.list-container').classList.toggle('active');
});