jQuery Plugin For Fullscreen One Page Scrolling Websites - fullPage.js

jQuery Plugin For Fullscreen One Page Scrolling Websites - fullPage.js
File Size: 8.45 MB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

fullPage.js is yet another jQuery plugin for one page website that allows you to create vertical or horizontal scrolling web page with smooth animations and easing options.

Licensed under the GPL-3.0.

Features:

  • Not only vertical scrolling but also horizontal scrolling. 
  • Easy to use. Configurable and customizable.
  • Working in modern and old browsers too!
  • Responsive designed to fit to different screen sizes as well as tablet and mobile devices. 
  • Auto scrolling on page load
  • Supports mousewheel scrolling

You might also like:

How to use it:

1. Include the latest version of jQuery library on your one page website.

<script src="http://code.jquery.com/jquery-latest.min.js"></script>

2. OPTIONAL. Include an easing library for extra easing effects. E.g. jQuery UI, jQuery easing plugin, etc.

<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js"></script>

3. Include the jQuery fullPage.js plugin after jQuery.

<link rel="stylesheet" href="jquery.fullPage.css" />
<script src="jquery.fullPage.js"></script>

4. Create the html for your one page website.

<div id="fullpage">
  <div class="section">One</div>
  <div class="section">Two</div>
  <div class="section">Three</div>
</div>

5. The plugin also supports nested pages.

<div id="fullpage">
  <div class="section">One</div>
  <div class="section">
    <div class="slide" data-anchor="slide1">Two 1</div>
    <div class="slide" data-anchor="slide2">Two 2</div>
  </div>
  <div class="section">Three</div>
</div>

6. You can also create some navigation links to scroll between sections by mouse click

<ul id="menu">
  <li data-menuanchor="firstPage"><a href="#firstPage">First slide</a></li>
  <li data-menuanchor="secondPage"><a href="#secondPage">Second slide</a></li>
  <li data-menuanchor="3rdPage"><a href="#3rdPage">Third slide</a></li>
  <li data-menuanchor="4thpage"><a href="#4thpage">Fourth slide</a></li>
</ul>

7. Call the plugin to enable the one page scrolling effect.

new fullpage('#fullpage', OPTIONS);

8. All plugin options to customize the one page scrolling effect.

// A selector used to specify the menu to link with the sections
menu: false,

// Defines the anchor links
anchors:[],

// Whether anchors in the URL will have any effect at all in the library
lockAnchors: false,

// Enables navigation
navigation: false,

// Or 'left'
navigationPosition: 'right',

// An array of tooltips
navigationTooltips: [],

// Enables active tooltip
showActiveTooltip: false,

// Shows a navigation for each landscape slide
slidesNavigation: false,

// Or 'top'
slidesNavPosition: 'bottom',

// Shows browser scrollbar
scrollBar: false,
hybrid: false,

// Whether to use JavaScript or CSS3 transforms
css3: true,

// Scrolling speed in ms
scrollingSpeed: 700,

// Enables auto scrolling
autoScrolling: true,

// Auto fits sections to the viewport
fitToSection: true,

// In ms
fitToSectionDelay: 1000,

// Easing effect
easing: 'easeInOutCubic',
easingcss3: 'ease',
loopBottom: false,

// Auto scrolls to the top/bottom
loopTop: false,

// Enables infinite looping on horizontal sliders
loopHorizontal: true,

// Defines whether scrolling down in the last section or should scroll down to the first one and if scrolling up in the first section should scroll up to the last one. 
continuousVertical: false,

// Defines whether sliding right in the last slide should slide right to the first one or not, and if scrolling left in the first slide should slide left to the last one or not.
continuousHorizontal: false,

// Slides horizontally within sliders by using the mouse wheel or trackpad
scrollHorizontally: false,

// Moving one horizontal slider will force the sliding of sliders in other section in the same direction
interlockedSlides: false,

// Enables drag and move
// true: enables the feature.
// false: disables the feature.
// vertical: enables the feature only vertically.
// horizontal: enables the feature only horizontally.
// fingersonly: enables the feature for touch devices only.
// mouseonly: enables the feature for desktop devices only (mouse and trackpad).
dragAndMove: false,

// Use non full screen sections based on percentage
offsetSections: false,

// Resets every slider after leaving its section
resetSliders: false,

// Uses fade effect instead
fadingEffect: false,

// If you want to avoid the auto scroll when scrolling over some elements, this is the option you need to use. (useful for maps, scrolling divs etc.) 
// It requires a string with the Javascript selectors for those elements. (For example: normalScrollElements: '#element1, .element2'). 
normalScrollElements: null,

// Creates a scroll for the section/slide in case its content is bigger than the height of it
scrollOverflow: false,

// Scrolls up the content of the section/slide with scroll bar when leaving to another vertical section
scrollOverflowReset: false,

// Requires iScroll.js library
scrollOverflowOptions: null,

// Defines a percentage of the browsers window width/height, and how far a swipe must measure for navigating to the next section / slide.
touchSensitivity: 5,
touchWrapper: typeof containerSelector === 'string' ? $(containerSelector)[0] : containerSelector,

// Defines the threshold for the number of hops up the html node tree 
normalScrollElementTouchThreshold: 5,

// Defines how to scroll to a section which size is bigger than the viewport.
// top, bottom, null
bigSectionsDestination: null,

// Accessibility
keyboardScrolling: true,

// Enables smooth scroll on anchor links
animateAnchor: true,

// Records URL history
recordHistory: true,

// Shows navigation arrows
controlArrows: true,

// Arrow color
controlArrowColor: '#fff',

// Vertically centered?
verticalCentered: true,

// An array of colors for page sections
sectionsColor : [],

// padding in pixels
paddingTop: 0,
paddingBottom: 0,

// Which elements will be taken off the scrolling structure of the plugin which is necessary when using the css3 option to keep them fixed
fixedElements: null,

// Backwards compabitility with responsiveWiddth
responsive: 0, 

// A normal scroll (autoScrolling:false) will be used under the defined width in pixels
responsiveWidth: 0,

// A normal scroll (autoScrolling:false) will be used under the defined height in pixels
responsiveHeight: 0,

// When set to true slides will be turned into vertical sections when responsive mode is fired
responsiveSlides: false,

// Enables parallax backgrounds effects
parallax: false,

// Parallax options
parallaxOptions: {
  type: 'reveal',
  percentage: 62,
  property: 'translate'
},

// Enables card effects
cards: false,

// Card options
cardsOptions: {
  perspective: 100,
  fadeContent: true,
  fadeBackground: true
},

// Custom selectors
sectionSelector: '.section',
slideSelector: '.slide',

// Lazy load media elements
lazyLoading: true

9. Callback functions.

new fullpage('#fullpage', {
    afterLoad: function(origin, destination, direction){
      // ...
    },

    onLeave: function(origin, destination, direction){
      // ...
    },

    afterRender: function(){
      // ...
    },

    afterResize: function(width, height){
      // ...
    },

    afterReBuild: function(){
      // ...
    },

    afterSlideLoad: function(section, origin, destination, direction){
      // ...
    },

    onSlideLeave: function(section, origin, destination, direction){
      // ...
    },

    afterResponsive: function(isResponsive){
      // ...
    }
});

10. API methods.

// Gets the active section and its properties
fullpage_api.getActiveSection();

// Gets the active slide and its properties
fullpage_api.getActiveSlide();

// Scrolls up
fullpage_api.moveSectionUp();

// Scrolls down
fullpage_api.moveSectionDown();

// Moves to a specific section & slide
fullpage_api.moveTo('firstSlide', 2);
fullpage_api.moveTo(3, 0);
fullpage_api.moveTo(3);

// Without animation
silentMoveTo(section, slide)
fullpage_api.silentMoveTo('firstSlide', 2);

// Scrolls right
fullpage_api.moveSlideRight();

// Scrolls left
fullpage_api.moveSlideLeft();

// Sets auto scrolling
fullpage_api.setAutoScrolling(false);

// Sets the value for the option fitToSection determining whether to fit the section in the screen or not
fullpage_api.setFitToSection(false);

// Fit the active section to the viewport
fullpage_api.fitToSection();


// Sets the value for the option lockAnchors determining whether anchors will have any effect in the URL or not
fullpage_api.setLockAnchors(false);

// Adds or remove the possibility of scrolling through sections/slides by using the mouse wheel/trackpad or touch gestures (which is active by default) 
fullpage_api.setAllowScrolling(false);
fullpage_api.setAllowScrolling(false, 'down');
fullpage_api.setAllowScrolling(false, 'down, right');

// Adds or remove the possibility of scrolling through sections by using the keyboard (which is active by default)
fullpage_api.setKeyboardScrolling(false);
fullpage_api.setKeyboardScrolling(false, 'down');
fullpage_api.setKeyboardScrolling(false, 'down, right');

// Enables/disables URL history
fullpage_api.setRecordHistory(false);

// Sets the scrolling speed in milliseconds.
fullpage_api.setScrollingSpeed(700);

// Destroys the plugin
fullpage_api.destroy();
fullpage_api.destroy('all');

// Re-builds the plugin
fullpage_api.reBuild();

// Sets the responsive mode of the page
fullpage_api.setResponsive(true);

// Turns horizontal slides into vertical sections
fullpage_api.responsiveSlides.toSections();

// Turns back the original slides (now converted into vertical sections) into horizontal slides again
fullpage_api.responsiveSlides.toSlides();

Changelog:

v3.0.5 (2019-04-11)

  • Fixing options typo & updating dist files

v3.0.4 (2018-11-30)

  • Updating version and dist files

v3.0.2 (2018-07-26)

  • Updating version and dist files

v3.0.1 (2018-06-27)

  • Updating version and dist files

v2.9.7 (2018-04-09)

  • Updating version and dist files

v2.9.6 (2018-01-30)

  • Updating version and dist files

v2.9.5 (2017-10-25)

  • Updating version and dist files

v2.9.4 (2017-03-11)

  • Added: lazy load for picture srcset elements

v2.9.3 (2017-03-01)

  • Adding parallax extension

v2.7.9 (2016-04-15)

v2.6.6 (2015-06-08)

  • ixed mousewheel for old firefox versions
  • Fixed bug with slimScroll 
  • Fixed bug when using scrollBar:true and opening a new tab (ctrl + t)
  • Added new option lockAnchors to lock anchors #1198
  • Added new option responsiveHeight 
  • Added new option responsiveWidth replacing the old option responsive
  • Added new function setLockAnchors 
  • Modified setKeyboardScrolling function to lock keyboard scrolling in specific directions
  • Added new functionality to cancel the scroll before it takes place
  • Callback onSlideLeave has now a new parameter nextIndex
  • Single slide inside section won't show navigation bullets 
  • Added a new functionality to lazy load images, videos and audio elements.
  • Added a new functionality to play and stop videos/audios when they enter in the viewport

v2.6.5 (2015-05-01)

  • Fixed bug using scrollOverflow:true and autoScrolling:false #553
  • Fixed bug using zoom (ctrl + mouse)
  • afterLoad callback will now fire on page render as well
  • Fixed bug with setAllowScrolling right and left
  • Fixed bug which fired multiple callbacks when using continuousVertical
  • Added new method $.fn.fullpage.silentMove to scroll with no animation 
  • Window resize has no animation now
  • Added npm installation to the documentation
  • Improved documentation about Creating links to sections or slides and anchors
  • Added some more comments in the code

v2.6.3 (2015-04-10)

  • Solved bug with slide anchors

2014-09-20

  • Double click over bullets on touch devices no longer needed

2014-07-01

  • Solved problem with common selectors. 

This awesome jQuery plugin is developed by alvarotrigo. For more Advanced Usages, please check the demo page or visit the official website.