zoukankan      html  css  js  c++  java
  • scroll-behavior 让滚动更顺滑

    使用场景:

    <header>
            <a href="#part1">第一屏</a>
            <a href="#part2">第二屏</a>
            <a href="#part3">第三屏</a>
            <a href="#part4">第四屏</a>
        </header>
    
        <section id="part1">这是第一屏内容</section>
        <section id="part2">这是第二屏内容</section>
        <section id="part3">这是第三屏内容</section>
        <section id="part4">这是第四屏内容</section>
    

      

    html{
           scroll-behavior:smooth; 
        }
            body,p{margin: 0;padding: 0;font-family:'Microsoft yahei';}
            header{
                height:40px;
                line-height: 40px;
                background: #efefef;
                text-align: center;
                margin-bottom: 10px;
            }
            header a{
                color:#333;
                text-decoration:none;
                padding:0 20px;
            }
            
            section{
                 100%;
                height: 500px;
                line-height: 500px;
                font-size: 20px;
                text-align: center;
                background: #efefef;
                margin-bottom:5px;
            }
    

      

    Gif有时候会卡,可以点击此链接查看线上demo(chrome版本号高于61才能看出来效果哦)

    目前兼容性不太好,如下:

  • 相关阅读:
    jmeter上做分布压测
    jpg,jpeg,bmp,png,gif图片格式区别
    jmeter的命令行进行压力测试
    Java8新特性
    02-Git
    01-Maven
    Java-集合
    Java-I/O框架
    mongodb安装配置
    Nginx常见错误及处理方法
  • 原文地址:https://www.cnblogs.com/fe-cherrydlh/p/9914356.html
Copyright © 2011-2022 走看看