full-page插件的使用

一、搭建full-page环境

1、依次下载jquery-3.0.0.min.js、jquery-ui-min.js和jquery.fullPage.js

//因为full-page是基于jquery开发的,所以必须要有jquery的支持;另要设置easing参数,所以也必须要有jquery-ui的支持。

二、html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>demo</title>

    <!-- 引用full-page自带的css文件 -->
    <link rel="stylesheet" href="css/jquery.fullPage.css">
    <!-- 引用自己设置的css动画样式 -->
    <link rel="stylesheet" href="css/index.css">

    <style>
        /*改进右侧的导航界面,采用雪碧图的方式*/
        #fp-nav ul li a {/*未激活的样式*/
        float: right;
        width: 21px;
        height: 21px;
        color: #8F9DA4;
        text-decoration: none;
        text-align: right;
        background: url("images/nav-ico.png") 5px 5px no-repeat;
        }
        /*鼠标移上去激活的样式*/
        #fp-nav ul li .active {
            background-position: 0 bottom;
        }
        
    </style>
    
    <!-- 引用js文件 -->
    <script src="js/jquery-3.0.0.min.js"></script>
    <script src="js/jquery-ui.min.js"></script>
    <script src="js/jquery.fullPage.min.js"></script>

    <!-- 启动full-page -->
    <script>
        $(function() {
             $('#fullpage').fullpage({
            // 'verticalCentered': false,
            anchors: ['page1', 'page2', 'page3', 'page4'],
            'navigation': true,
            // 'navigationColor':'#cccccc',
            'navigationPosition': 'right',
            'navigationTooltips': ['fullPage.js', 'Powerful', 'Amazing', 'Simple']
                })
        });
    </script>

</head>
<body>
    <div id="fullpage">

        <!-- 第一画面 -->
        <div class="section">
            <div class="bg">
                <img src="images/page1-img.png" alt="">
            </div>
            <div class="bg11"></div><!-- 此处图片作动画 -->
            <div class="bg12"></div><!-- 此处图片作动画 -->
        </div>

        <!-- 第二画面 -->
        <div class="section">
            <div class="bg">
                <img src="images/page2-img.png" alt="">
            </div>
        </div>

        <!-- 第三画面 -->
        <div class="section">
            <div class="bg">
                <img src="images/page3-img.png" alt="">
            </div>
        </div>

    </div>
</body>
</html>

三、index.css

.bg11{
    position: absolute;
    width: 79px;
    height: 263px;
    left: 0;
    top:140px;
    background: url("../images/bg11.png") no-repeat;
    opacity: 0;
    transition:all 1s;
}
.active .bg11{
    left: 400px;
    opacity: 1;
    transition-delay:0.7s;
}

.bg12{
    position: absolute;
    width: 943px;
    height: 587px;
    left: 25%;
    top:-15%;
    transform:scale(0.5,0.5);
    opacity: 0;
    background: url("../images/bg12.png") no-repeat;
    transition:all 1s;
}

.active .bg12{
    opacity: 1;
    transform:scale(1,1);
    transition-delay:.7s;
}

四、雪碧图背景图片

转载于:https://www.cnblogs.com/beast-king/p/5633752.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值