页面滚动平滑js插件

插件:SmoothScroll.js
CDN:https://cdnjs.com/libraries/smoothscroll
用法大概就下边这样了:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            div {
                height: 600px;
                border: 1px solid black;
                margin: 5px;
            }
        </style>
        <script src="./js/SmoothScroll.js"></script>
    </head>
    <body>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <script>
            SmoothScroll({
                frameRate: 150,
                animationTime: 1000,
                stepSize: 100,
                pulseAlgorithm: 1,
                pulseScale: 4,
                pulseNormalize: 1,
                accelerationDelta: 50,
                accelerationMax: 3,
                keyboardSupport: 1,
                arrowScroll: 50,
                fixedBackground: 1
            })
        </script>
    </body>
</html>
posted @ 2025-01-18 11:27  duanyong  阅读(26)  评论(0)    收藏  举报