js实现鼠标悬浮菜单图片跟随显示效果代码

代码语言:html

所属分类:悬停

代码描述:js实现鼠标悬浮菜单图片跟随显示效果代码

代码标签: js 鼠标 悬浮 菜单 图片 跟随

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

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

<head>

    <meta charset="UTF-8">

    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400&family=Rubik&display=swap" rel="stylesheet">



    <style>
        body {
          background-color: rgb(10, 10, 10);
          margin: 0px;
          overflow: hidden;
        }
        
        nav {
          display: flex;
          flex-direction: column;
          margin-top: 20vh;
          padding: clamp(1rem, 5vw, 6rem);
        }
        
        nav > a {
          color: rgba(255, 255, 255, 0.25);
          font-family: "Open Sans", sans-serif;
          font-size: clamp(3rem, 8vw, 10rem);
          font-weight: 300;
          text-decoration: none;
          position: relative;
        }
        
        nav > a:hover {
          color: white;
        }
        
        nav > a > span {
          display: block;
          border-bottom: 1px solid transparent;
          border-top: 1px solid transparent;
          position: relative;
          z-index: 2;
        }
        
        nav > a:hover > span {  
          border-top-color: white;
          border-bottom-color: white;
        }
        
        nav > a > img {
          position: absolute;
          opacity: 0;
          transform: translate(-50%, -50%) scale(0.5);
          transition: transform 250ms, opacity 250ms;
          pointer-events: none;
          width: min(40vw, 500px);
        }
        
        nav > a:hover > img {
          opacity: 1;
          transform: translate(-50%, -50%) scale(1);
        }
        
        /* -- YouTube Link Styles -- */
        
        body.menu-toggled > .meta-link > span {
          color: rgb(30, 30, 30);
        }
        
        #source-link {
          bottom: 60px;
        }
        
        #source-link > i {
          color: rgb(94, 106, 210);
        }
        
        #yt-link > i {
          color: rgb(239, 83, 80);
        .........完整代码请登录后点击上方下载按钮下载查看

网友评论0