css圆形弹出菜单按钮效果

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>圆形弹出菜单按钮</title>
    <link rel="stylesheet" href="../assets/css/1.圆形弹出菜单按钮.css">
  </head>
  <body>
    <main class="container">
        <div class="wrap">
            <input type="checkbox"  id="checking" style="display: none;">
                <button class="blob"></button>
                <button class="blob"></button>
                <button class="blob"></button>
                <button class="blob"></button>
                <button class="blob"></button>
                <button class="blob"></button>
                <button class="blob"></button>
                <button class="blob"></button>
                <label class="blob" for="checking" >
                    <span class="bar"></span>
                    <span class="bar"></span>
                    <span class="bar"></span>
                </label>
            </input>
        </div>
    </main> 
    <svg>
        <def>
            <filter id="filt">
                <fegaussianblur in="SourceGraphic" result="blur" stdDeviation="10"></fegaussianblur>
                <fecolormatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 18 -7" result="filt"></fecolormatrix>
                <feblend in2="filt" in="SourceGraphic" result="mix"></feblend>
            </filter>
        </def>
    </svg>
  </body>
</html>

body {
  margin: 0;
  padding: 0;
  background-color: #222;
}
* {
  color: #888;
  font-family: "Lato", Helvetica, sans-serif;
}
.wrap {
  position: absolute;
  top: 20px;
  left: 20px;
  margin: auto;
  width: 150px;
  height: 100px;
  filter: url("#filt");
  -webkit-filter: url("#filt");
}
.wrap .blob {
  display: block;
  cursor: pointer;
  border: none;
  outline: none;
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  z-index: 10;
  background-color: #f44336;
  box-shadow: 0 0 10px 1px rgba(255, 255, 255, 0.3) inset;
}
.bar {
  display: block;
  width: 40px;
  height: 5px;
  margin: 5px auto;
  background-color: #fff;
  border-radius: 2px;
  transition: all 0.4s linear 0.1s;
}
.bar:first-child {
  margin-top: 27px;
}
.wrap .blob[for="checking"] {
  z-index: 30;
  font-size: 60px;
  text-align: center;
  transition: transform 0.5s ease-in-out 0.2s;
}
.wrap .blob:not([for="checking"]) {
  width: 50px;
  height: 50px;
  top: 15px;
  left: 15px;
  font-size: 30px;
  transition: all 0.5s ease-in-out;
  background-color: #fff;
}
.wrap > #checking:checked ~ .blob:nth-child(2) {
  margin-left: 85px;
  margin-top: 10px;
}
.wrap > #checking:checked ~ .blob:nth-child(3) {
  margin-left: 65px;
  margin-top: 145px;
}
.wrap > #checking:checked ~ .blob:nth-child(4) {
  margin-left: 10px;
  margin-top: 160px;
}
.wrap > #checking:checked ~ .blob:nth-child(5) {
  margin-left: 10px;
  margin-top: 85px;
}
.wrap > #checking:checked ~ .blob:nth-child(6) {
  margin-left: 63px;
  margin-top: 63px;
}
.wrap > #checking:checked ~ .blob:nth-child(7) {
  margin-left: 145px;
  margin-top: 65px;
}
.wrap > #checking:checked ~ .blob:nth-child(8) {
  margin-left: 112px;
  margin-top: 112px;
}
.wrap > #checking:checked ~ .blob:nth-child(9) {
  margin-left: 160px;
  margin-top: 10px;
}
.wrap > #checking:checked ~ .blob[for="checking"] > .bar:nth-child(1) {
  transform: rotate(45deg);
  margin-top: 37px;
}
.wrap > #checking:checked ~ .blob[for="checking"] > .bar:nth-child(2) {
  transform: rotate(-45deg);
  margin-top: -10px;
}
.wrap > #checking:checked ~ .blob[for="checking"] > .bar:nth-child(3) {
  opacity: 0;
}
.wrap .blob:not([for="checking"]):hover {
  color: #f44336;
  animation: harlem 0.5s linear forwards;
}
@keyframes harlem {
  0% {
    transform: translate(0);
  }
  25% {
    transform: translate(5px, 5px);
  }
  50% {
    transform: translate(-5px, -5px);
  }
  75% {
    transform: translate(2px, 2px);
  }
  100% {
    transform: translate(0);
  }
}

在这里插入图片描述

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值