前端页面整屏滚动fullpage.js简单使用

官网CSS,JS地址

fullPage.js/dist/fullpage.min.js at master · alvarotrigo/fullPage.js · GitHub

fullPage.js/dist/fullpage.min.css at master · alvarotrigo/fullPage.js · GitHub

html 复制代码
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    #fullpage .section {
        text-align: center;
        font-size: 2em;
        color: white;
    }

    #fullpage .section:nth-child(1) { background-color: #3498db; }
    #fullpage .section:nth-child(2) { background-color: #e74c3c; }
    #fullpage .section:nth-child(3) { background-color: #2ecc71; }
    #fullpage .section:nth-child(4) { background-color: pink; }
</style>
<body>
    <div id="fullpage">
        <div class="section">第一屏</div>
        <div class="section">第二屏</div>
        <div class="section">第三屏</div>
        <div class="section fp-auto-height">第四屏 fp-auto-height自定义高度</div>
    </div>

    <link rel="stylesheet" href="./fullpage.min.css">
    <script src="./fullpage.min.js"></script>
    <script>

        var myFullpage = new fullpage('#fullpage', {
            navigation: true, // 显示导航点
            slidesNavigation: true, // 如果有横向滑动的面板,显示横向导航
            scrollingSpeed: 1000, // 滚动速度,单位为毫秒
            easing: 'easeInOutCubic', // 滚动动画的速度曲线
            css3: true // 使用 CSS3 transforms 进行滚动
        });

    </script>
</body>

</html>

效果图:

相关推荐
华科大胡子9 小时前
AI开发者的网络卡点:Anthropic连接超时
开发语言·php
磊 子10 小时前
STL无序关联容器—unorded_set+unorded_map
开发语言·c++
向量引擎10 小时前
从零起步,如何打造专属向量引擎 API 中转工作流?
java·服务器·前端
AI人工智能+电脑小能手10 小时前
【大白话说Java面试题 第84题】【Mysql篇】第14题:为什么用 InnoDB 存储引擎的表建议用整型的自增主键?
java·开发语言·数据库·mysql·面试
丷丩10 小时前
MapLibre GL JS第27课:添加COG栅格源
javascript·map·mapbox·maplibre gl js
IT_陈寒10 小时前
Vue这个动态响应坑把我整不会了
前端·人工智能·后端
bestlanzi10 小时前
使用nvm管理node环境
前端·vue.js·npm
YikNjy11 小时前
break和continue
java·开发语言·算法
SomeOtherTime11 小时前
Geojson相关(AI回答)
java·前端·python
秋911 小时前
java项目中cpu飙升排查及解决方法
java·开发语言