js+css实现页面滚动左侧页数指示圆点效果代码

代码语言:html

所属分类:加载滚动

代码描述:js+css实现页面滚动左侧页数指示圆点效果代码

代码标签: js css 页面 滚动 左侧 页数 指示 圆点

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

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

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




    <style>
        @import url("https://fonts.googleapis.com/css?family=Hanken%20Grotesk:700|Hanken%20Grotesk:400");
        
        :root {
          --text: #c5c5d1;
          --background: #191924;
          --secondary: #2b2234;
          --accent: #463854;
        }
        
        h1 {
          font-size: 4.21rem; /* 67.36px */
        }
        
        h2 {
          font-size: 3.158rem; /* 50.56px */
        }
        
        h3 {
          font-size: 2rem;
        }
        
        p {
          font-size: 1rem;
          line-height: 175%;
        }
        
        * {
          scroll-behavior: smooth;
          box-sizing: border-box;
          font-family: "Hanken Grotesk";
          font-size: 1rem;
          transition: all ease 0.1s;
        }
        
        body {
          background-color: var(--background);
          color: var(--text);
        }
        
        a {
          text-decoration: none;
          color: inherit;
          position: relative;
          opacity: 0;
          text-wrap: nowrap;
          display: block;
        }
        
        .progress-bar:hover a {
          opacity: 1;
        }
        
        main {
          display: flex;
          flex-direction: row;
          justify-content: flex-start;
          position: relative;
          width: 100%;
          gap: 5%;
        }
        
        #sidebar {
          position: relative;
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: flex-start;
          width: 20%;
          height: 100vh;
        }
        
        .progress-bar {
          position: fixed;
          display: flex;
          flex-direction: column;
          gap: 1rem;
          border: 2px solid var(--secondary);
          border-radius: 2rem;
          padding: 1rem;
          cursor: pointer;
        }
        
        .content {
          position: relative;
          max-width: 50%;
          padding: 0;
        }
        
        .section {
          height: 100vh;
        }
        
        li {
          list-style: none;
          width: 1rem;
          height: 1rem;
        
          background-color: var(--secondary);
          border-radius: 1rem;
        }
        
        li:hover {
          background-color: var(--accent);
        }
        
        .progress-bar:hover li {
          width: 100%;
          height: 100%;
          padding: 0.5rem 1rem;
        }
        
        li.active {
          background-color: var(--accent);
        }
        
        
        @media screen and (max-width: 800px) {
          #sidebar {
            display: none;
          }
          .content {
            max-width: 100%;
          }
          main {
            padding: 0 5%;
          }
          .section {
            height: auto;
          }
        }
    </style>



</head>

<body translate="no">

    <main>

        <div id="sidebar">
            <ul class="progress-bar">
                <li><a href="#section1">Intro</a></li>
                <li><a href="#section2">Characteristics</a></li>
                <li><a href="#section3">Communication</a></li>
                <li><a href="#section4">Whiskers</a></li>
            </ul>
        </div>

        <div class="content">
            <div id="section1" class="section">
                <h1>Cat</h1>
                <p>The cat (Felis catus), commonly referred to as the domestic cat or house cat, is a small domesticated carnivorous mammal.........完整代码请登录后点击上方下载按钮下载查看

网友评论0