svg+js实现鼠标悬浮跟随文字导航条效果代码

代码语言:html

所属分类:菜单导航

代码描述:svg+js实现鼠标悬浮跟随文字导航条效果代码

代码标签: svg js 鼠标 悬浮 跟随 文字 导航条

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

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

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

  
  <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Zeyada&amp;display=swap'>
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;700&display=swap");
* {
  padding: 0;
  margin: 0;
  letter-spacing: 3px;
}

body {
  background: #0c0b0b;
  width: 99%;
  height: 100vh;
  overflow: hidden;
  font-family: "Roboto Condensed", sans-serif;
  display: grid;
  place-items: center;
}

header {
  height: 3rem;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fffae1;
  padding: 1.5rem 1rem;
}
header .menu {
  display: flex;
}
header .menu a {
  text-decoration: none;
  margin: 0 1rem;
  color: #fffae1;
  position: relative;
  display: block;
  z-index: 999;
  font-size: 20px;
}
header .menu a .outter::before {
  content: "";
  background: #fffae1;
  position: absolute;
  height: 1px;
  width: calc(100% + 12px);
  top: 0;
  left: 0;
  left: -8px;
  transform: scale(0);
  transform-origin: left;
  transition: 0.6s ease;
}
header .menu a .outter::after {
  content: "";
  background: #fffae1;
  position: absolute;
  height: 1px;
  width: calc(100% + 12px);
  bottom: 0;
  left: -8px;
  transform: scale(0);
  transform-origin: right;
  transition: 0.6s ease;
}
header .menu a .inner::before {
  content: "";
  background: #fffae1;
  position: absolute;
  width: 1px;
  height: calc(100% + 10px);
  top: -5px;
  left: -2px;
  transform: scale(0);
  transform-origin: bottom;
  transition: 0.6s ease;
}
header .menu a .inner::after {
  content: "";
  background: #fffae1;
  position: absolute;
  width: 1px;
  height: calc(100% + 10px);
  top: -5px;
  right: 0px;
  transform: scale(0);
  transform-origin: top;
  transition: 0.6s ease;
}
header .menu a:hover span::before {
  transform: scale(1);
}
header .menu a:hover span::after {
  transform: scale(1);
}

.cursor {
  width: 100px;
  height: 100px;
  border: 1px solid #fffae1;
  border-radius: 50%;
  position: absolute;
  transition: 0.1s ease;
  z-index: -2;
  opacity: 1;
  top: -100px;
  left: -100px;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0