fullpage.js整屏滚动用法

公司在做官网是看到别的同类公司有用到整屏滚动感觉效果好看,就要求帮我们也要做这个效果,网上到是搜到不少,但是多多少少复制过来都有点问题。今天我就把我已经做好的代码贴上来,省的大家走冤枉路,代码如下:
// 因为我是vue项目
//所以第一步安装: npm run vue-fullpage.js

//第二部引用:
//main.js中引用
//import VueFullpage from 'vue-fullpage.js'
// Vue.use(VueFullpage)

//第三部:
//网上下载fullpage.min.css引入到public文件夹中的index.html文件中
//如果不知道在哪里下也没关系,下面我会将代码贴出来

//第四部:vue组件中使用:

 <full-page :options="options">
      <div class="section">
        <div class='box1">
         section1
        </div>
      </div>
      <div class="section">
        <div class='box2">
         section2
        </div>
      </div>
      <div class="section">
        <div class='box3">
         section3
        </div>
      </div>
      <div class="section">
        <div class='box4">
         section4
        </div>
      </div>
    </full-page>
  
export default {
 options: {
                licenseKey: "OPEN-SOURCE-GPLV3-LICENSE",
                afterLoad: this.afterLoad,
                scrollOverflow: true,
                scrollBar: false,
                menu: "#menu",
                // navigation: true,  小圆点颜色可以在fullpage.min.js文件中修改。
                // anchors: ['page1', 'page2', 'page3'],
                sectionsColor: [
                  "#41b883",
                  "#ff5f45",
                  "#0798ec",
                  "#fec401",
                  "#1bcee6",
                  "#ee1a59",
                  "#2c3e4f",
                  "#ba5be9",
                  "#b4b8ab"
                ]
              }

}
fullpage.min.css文件代码:
/*!
 * fullPage 3.0.8
 * https://github.com/alvarotrigo/fullPage.js
 *
 * @license GPLv3 for open source use only
 * or Fullpage Commercial License for commercial use
 * http://alvarotrigo.com/fullPage/pricing/
 *
 * Copyright (C) 2018 http://alvarotrigo.com/fullPage - A project by Alvaro Trigo
 */

.fp-enabled body,
html.fp-enabled {
    margin: 0;
    padding: 0;
    overflow: hidden;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0)
}

.fp-section {
    position: relative;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box
}

.fp-slide {
    float: left
}

.fp-slide,
.fp-slidesContainer {
    height: 100%;
    display: block
}

.fp-slides {
    z-index: 1;
    height: 100%;
    overflow: hidden;
    position: relative;
    -webkit-transition: all .3s ease-out;
    transition: all .3s ease-out
}

.fp-section.fp-table,
.fp-slide.fp-table {
    display: table;
    table-layout: fixed;
    width: 100%
}

.fp-tableCell {
    vertical-align: middle;
    width: 100%;
    height: 100%
}

.fp-slidesContainer {
    float: left;
    position: relative
}

.fp-controlArrow {
    -webkit-user-select: none;
    -moz-user-select: none;
    -khtml-user-select: none;
    -ms-user-select: none;
    position: absolute;
    z-index: 4;
    top: 50%;
    cursor: pointer;
    width: 0;
    height: 0;
    border-style: solid;
    margin-top: -38px;
    -webkit-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0)
}

.fp-controlArrow.fp-prev {
    left: 15px;
    width: 0;
    border-width: 38.5px 34px 38.5px 0;
    border-color: transparent #fff transparent transparent
}

.fp-controlArrow.fp-next {
    right: 15px;
    border-width: 38.5px 0 38.5px 34px;
    border-color: transparent transparent transparent #fff
}

.fp-scrollable {
    overflow: hidden;
    position: relative
}

.fp-scroller {
    overflow: hidden
}

.iScrollIndicator {
    border: 0!important
}

.fp-notransition {
    -webkit-transition: none!important;
    transition: none!important
}

#fp-nav {
    position: fixed;
    z-index: 100;
    margin-top: -32px;
    top: 50%;
    opacity: 1;
    -webkit-transform: translate3d(0, 0, 0)
}

#fp-nav.fp-right {
    right: 17px
}

#fp-nav.fp-left {
    left: 17px
}

.fp-slidesNav {
    position: absolute;
    z-index: 4;
    opacity: 1;
    -webkit-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    left: 0!important;
    right: 0;
    margin: 0 auto!important
}

.fp-slidesNav.fp-bottom {
    bottom: 17px
}

.fp-slidesNav.fp-top {
    top: 17px
}

#fp-nav ul,
.fp-slidesNav ul {
    margin: 0;
    padding: 0
}

#fp-nav ul li,
.fp-slidesNav ul li {
    display: block;
    width: 14px;
    height: 13px;
    margin: 7px;
    position: relative
}

.fp-slidesNav ul li {
    display: inline-block
}

#fp-nav ul li a,
.fp-slidesNav ul li a {
    display: block;
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    cursor: pointer;
    text-decoration: none
}

#fp-nav ul li a.active span,
#fp-nav ul li:hover a.active span,
.fp-slidesNav ul li a.active span,
.fp-slidesNav ul li:hover a.active span {
    height: 12px;
    width: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 100%;
    background: #DD4533;
}

#fp-nav ul li a span,
.fp-slidesNav ul li a span {
    border-radius: 50%;
    position: absolute;
    z-index: 1;
    height: 4px;
    width: 4px;
    border: 0;
    background: white;
    left: 50%;
    top: 50%;
    margin: -2px 0 0 -2px;
    -webkit-transition: all .1s ease-in-out;
    -moz-transition: all .1s ease-in-out;
    -o-transition: all .1s ease-in-out;
    transition: all .1s ease-in-out
}

#fp-nav ul li:hover a span,
.fp-slidesNav ul li:hover a span {
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px
}

#fp-nav ul li .fp-tooltip {
    position: absolute;
    top: -2px;
    color: #fff;
    font-size: 14px;
    font-family: arial, helvetica, sans-serif;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    display: block;
    opacity: 0;
    width: 0;
    cursor: pointer
}

#fp-nav ul li:hover .fp-tooltip,
#fp-nav.fp-show-active a.active+.fp-tooltip {
    -webkit-transition: opacity .2s ease-in;
    transition: opacity .2s ease-in;
    width: auto;
    opacity: 1
}

#fp-nav ul li .fp-tooltip.fp-right {
    right: 20px
}

#fp-nav ul li .fp-tooltip.fp-left {
    left: 20px
}

.fp-auto-height .fp-slide,
.fp-auto-height .fp-tableCell,
.fp-auto-height.fp-section {
    height: auto!important
}

.fp-responsive .fp-auto-height-responsive .fp-slide,
.fp-responsive .fp-auto-height-responsive .fp-tableCell,
.fp-responsive .fp-auto-height-responsive.fp-section {
    height: auto!important
}

.fp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}


/*# sourceMappingURL=fullpage.min.css.map */
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值