css+js实现炫酷的气泡旋转菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:css+js实现炫酷的气泡旋转菜单效果代码

代码标签: 气泡 旋转 菜单 效果

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

<!doctype html>
<html>
<head>
<meta charset="utf-8">


<style>
*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  font-size: calc(16px + (20 - 16) * (100vw - 320px)/(980 - 320));
  --rotateTimes: 0;
}

body {
  background-color: #002;
  background-image: radial-gradient(circle at center, #045, #002);
  color: #fff;
  font: 1em "Open Sans", sans-serif;
  height: 100vh;
  line-height: 1.5;
}

nav, ul, li {
  transform-style: preserve-3d;
}

nav, li {
  position: absolute;
  top: 50%;
  left: 50%;
}

nav, li a {
  border-radius: 50%;
}

nav {
  width: 18em;
  height: 18em;
  transform: translate(-50%, -50%) rotateX(75deg);
}

ul, li a {
  width: 100%;
  height: 100%;
}

ul {
  list-style: none;
}

li {
  animation: idle 4s ease-in-out infinite;
  text-align: center;
  width: 5em;
  height: 5em;
  transform: translate(-50%, -50%);
}
li a {
  box-shadow: 0 0 0 0.1em #0cf inset, 0 0 1em #0cf inset;
  color: currentColor;
  display: inline-block;
  text-decoration: none;
  transition: transform 0.4s linear,  box-shadow 0.15s linear,  margin 0.1s linear,  width 0.1s linear,  height 0.1s linear;
}
li a span {
  transition: color 0.15s linear;
}
li a:before {
  background-color: #fff;
  border-radius: 50%;
  content: "";
  display: block;
  opacity: 0.5;
  position: absolute;
  top: 0.75em;
  left: 0.75em;
  width: 1em;
  height: 0.5em;
  transform: rotate(-45deg);
}
li a:focus, li a.current {
  box-shadow: 0 0 0 0.1em #ff0 inset, 0 0 1em #ff0 inset;
  outline: 0;
}
li a:focus span, li a.current span {
  color: #ff0;
}
li a:hover {
  margin: -5% 0 0 -5%;
  width: 110%;
  height: 110%;
}
li a:hover svg {
  width: 3em;
  height: 3em;
}

@media (prefers-reduced-motion) {
  li {
    animation: none;
  }
}
svg {
  display: block;
  margin: .........完整代码请登录后点击上方下载按钮下载查看

网友评论0