powerdong / myProblems

我用到了,你可能用到
0 stars 1 forks source link

移动端常用点击效果 #32

Open powerdong opened 4 years ago

powerdong commented 4 years ago
// 点击有波纹效果
.ripple {
  position: relative;
  overflow: hidden;
  user-select: none;

  &:after {
    position: absolute;
    content: '';
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    //设置径向渐变
    background-image: radial-gradient(circle, #666 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform .5s, opacity .6s;
  }

  &:active:after {
    transform: scale(0, 0);
    opacity: .3;
    //设置初始状态
    transition: 0s;
  }
}