pico+js实现未读铃铛消息数字角标变化效果代码

代码语言:html

所属分类:其他

代码描述:pico+js实现未读铃铛消息数字角标变化效果代码

代码标签: pico js 未读 铃铛 消息 数字 角标 变化

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/pico.2.0.6.css">
  
<style>
notification-bell {
  box-sizing: border-box;
  font-size: 4rem;
  position: relative;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3em;
  height: 3em;
  border-radius: 2em;
  border: 0.015em solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 1em rgba(0, 0, 0, 0.3);
  transition: 450ms;
}
notification-bell > svg {
  width: 70%;
}
notification-bell::after {
  content: attr(data-count);
  font-size: 0.75em;
  width: auto;
  height: 1.5em;
  min-width: 1.5em;
  border-radius: 0.75em;
  border: 0.1em solid #fff;
  padding: 0.2em;
  background: rgba(250, 50, 50, 0.95);
  display: inline-flex;
  color: #fff;
  align-items: center;
  justify-content: center;
  right: 4%;
  top: 18%;
  position: absolute;
}
notification-bell[data-count=""]::after {
  display: none;
}
notification-bell.animating {
  transition: 225ms;
  background: #d33;
}
notification-bell.animating > svg {
  fill: #fee;
  animation: notification-ring 225ms ease infinite;
  transform-origin-x: 50%;
  transform-origin-y: 0%;
  transform-origin-z: initial;
}
@keyframes notification-ring {
  0%, 80% {
    rotate: -5deg;
  }
  10%, 90% {
    rotate: 5deg;
  }
  20%, 40% {
    rotate: -10deg;
  }
  30%, 60% {
    rotate: 10deg;
  }
  80% {
    scale: 105%;
  }
  100% {
    rotate: 0deg;
  }
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(327deg, #00cafc 0%, #fdf52d 100%);
  cursor: pointer;
  font-size: calc(20px + (60 - 20) * (100vw - 320px) / (2560 - 320));
}

footer {
  position: absolute;
  bottom: 0;
  z-index: 9;
}
footer button {
  padding: 0.25em 0.5em;
}
</style>

  
  
</head>

<body translate="no">
  <notification-bell id='notification.........完整代码请登录后点击上方下载按钮下载查看

网友评论0