• Stars
    star
    1,825
  • Rank 24,399 (Top 0.5 %)
  • Language Vue
  • License
    GNU General Publi...
  • Created over 6 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Official Vue.js wrapper for fullPage.js http://alvarotrigo.com/vue-fullpage/

Vue-fullpage.js - Official Vue.js 3 wrapper

preview

Official Vue.js 3 wrapper for the fullpage.js library.

npm version

Table of contents

Installation

Terminal:

// With npm
npm install --save vue-fullpage.js

License

Commercial license

If you want to use fullPage to develop nonopen sourced sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. This means, you won't have to change your whole application source code to an open-source license. [Purchase a Fullpage Commercial License]

Open source license

If you are creating an open-source application under a license compatible with the GNU GPL license v3, you may use fullPage under the terms of the GPLv3.

You will have to provide a prominent notice that fullPage.js is in use. The credit comments in the JavaScript and CSS files should be kept intact (even after combination or minification).

Read more about fullPage's license.

Example

// With npm
cd example/
npm install
npm run start

Usage

Bundler (Vite)

import { createApp } from 'vue'
import App from './App.vue'

import 'vue-fullpage.js/dist/style.css'
import './fullpage.scrollHorizontally.min' // Optional. When using fullpage extensions
import VueFullPage from 'vue-fullpage.js'

const app = createApp(App)
app.use(VueFullPage)
app.mount('#app')

Notice that when using the option scrollOverflow:true or any fullPage.js extension you'll have to include the file for those features before the vue-fullpage component.

Browser

You can check a browser stand-alone demo here.

<!-- On the page head -->
<link
  rel="stylesheet"
  href="https://unpkg.com/vue-fullpage.js/dist/style.css"
/>

<!-- Include after Vue (before closing body) -->
<script type="module" src="https://unpkg.com/vue-fullpage.js/dist/vue-fullpage.es.js"></script>

Required HTML

This wrapper creates a <full-page> component , which you can use like other Vue.js components. For example:

<div>
  <full-page ref="fullpage" :options="options" id="fullpage">
    <div class="section">First section ...</div>
    <div class="section">Second section ...</div>
  </full-page>
</div>

Options

You can use any options supported by fullPage.js library. Just pass the options object into this wrapper like Vue.js property. Options object can contain simple options as well as fullPage.js callbacks.

Notice that if you want to make use of the option scrollOverflow:true, you'll have to include the scrollOverflow file before vue-fullpage.js, as detailed above.

Example:

export default {
  data() {
    return {
      options: {
        licenseKey: 'YOUR_KEY_HEERE',
        menu: '#menu',
        anchors: ['page1', 'page2', 'page3'],
        sectionsColor: ['#41b883', '#ff5f45', '#0798ec'],
      },
    }
  }
}

Delayed init

Full-page will init itself automatically on mount. This may not work properly when using async components inside its sections, as it has no way of knowing when said components are ready and mounted.

Use the skipInit prop to stop full-page from initializing itself. You can do it when youself by using a ref like:

<full-page ref="fullpage" :options="options" :skip-init="true"></full-page>
methods: {
  // Called when your components are ready. That is up to you to decide when.
  componentsReady() {
    this.$refs.fullpage.init()
  }
}

Methods

You can make use of any of the methods provided by fullPage.js by accessing the instance object via the reference $refs.fullpage.api.

Example:

<template>
  <div>
    <full-page ref="fullpage" :options="options">
      <div class="section">
        <button class="next" @click="$refs.fullpage.api.moveSectionDown()">
          Next
        </button>
        Section 1
      </div>
      <div class="section">
        <button class="prev" @click="$refs.fullpage.api.moveSectionUp()">
          Prev
        </button>
        Section 2
      </div>
    </full-page>
  </div>
</template>

Similar you can call any method of fullPage.js library directly on Javascript:

fullpage_api.setAllowScrolling(false)

Callbacks

As mentioned above you can pass callbacks through options object:

<template>
  <div>
    <full-page ref="fullpage" :options="options">
      <div class="section">First section ...</div>
      <div class="section">Second section ...</div>
    </full-page>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        options: {
          afterLoad: this.afterLoad,
        },
      }
    },

    methods: {
      afterLoad() {
        console.log("Emitted 'after load' event.")
      },
    },
  }
</script>

Or you can use the standard approach for event handling of Vue.js:

<template>
  <div>
    <full-page @after-load="afterLoad"> .... </full-page>
  </div>
</template>
<script>
  export default {
      methods: {
        afterLoad() {
          ...
        }
      }
    }
</script>

Similarly, you can handle any event of the fullPage.js library. Just translate camelCase name of callback to kebab-case and use it ;)

Dynamic changes

vue-fullpage.js will watch all changes taking place within the fullpage.js options but will NOT automatically watch any DOM changes. If you want vue-fullpage.js to react to DOM changes call the build() method after making those changes. For example:

//creating the section div
var section = document.createElement('div')
section.className = 'section'
section.innerHTML = '<h3>New Section</h3>'

//adding section
document.querySelector('#fullpage').appendChild(section)

//where --> var vm = new Vue({...}) if calling it from outside.
vm.$refs.fullpage.build()

//or, when calling it from inside the Vue component methods:
this.$refs.fullpage.build()

In order for fullPage.js to get updated after a change in any of the fullPage.js options, you'll have to make sure to use such an option in the initialization.

For example, if we want fullPage.js to get updated whenever I change the scrollBar and controlArrows options, I'll have to use the following initialisation:

export default {
  data() {
    return {
      options: {
        licenseKey: 'YOUR_KEY_HERE',
        controlArrows: true,
        scrollBar: true,
      },
    }
  },
}

Usage with Nuxt.js

Use the nuxt-fullpage module in order to use Nuxt with vue-fullpage.js.

๐Ÿšง Usage with Gridsome

TBD

Contributing

Please see Contributing to fullpage.js

Resources

More Repositories

1

fullPage.js

fullPage plugin by Alvaro Trigo. Create full screen pages fast and simple
JavaScript
34,897
star
2

pagePiling.js

pagePiling plugin by Alvaro Trigo. Create a scrolling pile of sections. http://alvarotrigo.com/pagePiling/
JavaScript
4,095
star
3

multiscroll.js

multiscroll plugin by Alvaro Trigo. Create scrolling split websites. http://alvarotrigo.com/multiScroll/
JavaScript
1,587
star
4

react-fullpage

Official React.js wrapper for fullPage.js https://alvarotrigo.com/react-fullpage/
JavaScript
1,266
star
5

angular-fullpage

Official Angular wrapper for fullPage.js https://alvarotrigo.com/angular-fullpage/
TypeScript
173
star
6

funnyText.js

Create funny and crazy moving texts in a simple way
JavaScript
171
star
7

skrollTop.js

Lightweight jQuery scrollTop animation without jQuery
JavaScript
36
star
8

validPic.js

Image validator for javascript based on mimetypes
JavaScript
36
star
9

fallingwords.js

Just having fun with HTML, CSS and Javascript
JavaScript
32
star
10

PHP-Backend

PHP
28
star
11

nuxt-fullpage

Official Nuxt Module For The Official vue-fullpage wrapper
Vue
17
star
12

landingScroll.js

Home page landing scroll by Alvaro Trigo
JavaScript
10
star
13

VB.NET

Some exercises i did on VB.NET. Both the interface and the code.
Visual Basic
8
star
14

CakePHP

Here i upload some public projects or functions i consider interesting.
PHP
5
star
15

Front-end--jQuery--CSS-

UI Interface - Front-end design
PHP
3
star
16

SQL---PL-SQL

3
star
17

Java

Java
3
star
18

david-5ef1d7a76a92e

This is the description of a repo
2
star
19

david-5ef1d1c5aa81d

This is the description of a repo
2
star
20

blog-assets

Assets
2
star
21

david-5ef1d28d594f3

This is the description of a repo
2
star
22

david-5ef1d76cede71

This is the description of a repo
2
star
23

loco4

Page created with fullSnap.io
HTML
1
star
24

loco3

Page created with fullSnap.io 2
HTML
1
star
25

loco2

Page created with fullSnap.io 2
HTML
1
star
26

loco5

Page created with fullSnap.io 2
HTML
1
star
27

OpColumns.js

jQuery Plugin to show or hide columns in tables.
1
star