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Hg9Ii0xIi8+CiA8L2c+CiA8Zz4KICA8dGl0bGU+TGF5ZXIgMTwvdGl0bGU+CiAg%0D%0APHBhdGggZmlsbD0iIzVjNWM1YyIgaWQ9InN2Z18xIiBkPSJtNDAuNDMsMjEuNzM5bC03LjY0NSww%0D%0AbDAsLTUuMDE0YzAsLTEuODgzIDEuMjQ4LC0yLjMyMiAyLjEyNywtMi4zMjJjMC44NzcsMCA1LjM5%0D%0ANSwwIDUuMzk1LDBsMCwtOC4yNzhsLTcuNDMsLTAuMDI5Yy04LjI0OCwwIC0xMC4xMjUsNi4xNzQg%0D%0ALTEwLjEyNSwxMC4xMjVsMCw1LjUxOGwtNC43NywwbDAsOC41M2w0Ljc3LDBjMCwxMC45NDcgMCwy%0D%0ANC4xMzcgMCwyNC4xMzdsMTAuMDMzLDBjMCwwIDAsLTEzLjMyIDAsLTI0LjEzN2w2Ljc3LDBsMC44%0D%0ANzUsLTguNTN6Ii8+CiA8L2c+Cjwvc3ZnPg==" class="menu__item menu__item--2">
</div>
</div>
:root{
--blue: #008EFA;
--pink: #FF207A;
--bg: #EEEEEE;
--white: #FEFEFE;
}
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
background-color: var(--bg);
}
.main{
display: flex;
justify-content: center;
align-items: flex-end;
width: 300px;
height: 200px;
position: relative;
}
.menu{
display: flex;
justify-content: space-between;
align-items: center;
width: 300px;
height: 100px;
padding: 30px;
border-radius: 5px;
box-shadow: 0 0 5px 1px rgba(0,0,0,.05);
background-color: var(--white);
}
.menu__trigger{
position: absolute;
top: 50px;
left: calc(50% - 50px);
width: 100px;
height: 100px;
background-color: var(--blue);
border: 10px solid var(--bg);
border-radius: 50%;
padding: 20px;
cursor: pointer;
transition: .35s ease;
}
.menu__base{
width: 20px;
height: 20px;
object-fit: contain;
opacity: .7;
}
.menu__item{
position: absolute;
width: 60px;
height: 60px;
top: 70px;
padding: 20px;
border-radius: 50%;
background-color: var(--white);
border: none;
box-shadow: 0 0 5px 1px rgba(0,0,0,.05);
z-index: -1000;
opacity: 0;
}
.menu__item--0{ transition: .35s ease; left: calc(50% - 30px);}
.menu__item--1{ transition: .35s ease .1s; left: calc(50% - 30px);}
.menu__item--2{ transition: .35s ease .2s; right: calc(50% - 30px);}
.is-rotate {
transform: rotateZ(225deg);
background-color: var(--pink);
}
.item-0 { top: 20px; left: calc(50% - 110px); opacity: 1;}
.item-1 { top: -25px; left: calc(50% - 30px); opacity: 1;}
.item-2 { top: 20px; right: calc(50% - 110px); opacity: 1;}
/*
Designed by: Nicholas.design
Original image: https://dribbble.com/shots/7160097-Add-Interaction
*/
const btn = document.querySelector("#btn");
const item = document.querySelectorAll(".menu__item");
let showCard = (event) => {
btn.classList.toggle("is-rotate");
for (var i = 0; i < item.length; i++) {
item[i].classList.toggle(`item-${i}`);
}
}
btn.addEventListener("click", showCard);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.