npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sdgluck/fullpage-react

v2.0.3

Published

full page scrolling for react

Downloads

4

Readme

Fullpage-React

Demo can be found here

A larger example setup can be found here


Basic Setup

NPM

npm install fullpage-react

All styling can be done via inline or stylesheets. Each component from Fullpage-React requires its own block of options

Component Option Boilerplate
const {Fullpage, Slide, HorizontalSlider, Overlay} = require('fullpage-react');

let fullPageOptions = {
  // for mouse/wheel events
  // represents the level of force required to generate a slide change on non-mobile, 10 is default
  scrollSensitivity: 2,

  // for touchStart/touchEnd/mobile scrolling
  // represents the level of force required to generate a slide change on mobile, 10 is default
  touchSensitivity: 2,
  scrollSpeed: 500,

  // when the final scroll is reached, this option allows the user to scroll backward to the original slide if they try to progress
  // similar to infinite but the user will see a longer & reversed animation
  resetSlides: true,
  // auto-apply styles to hide scrollbars
  hideScrollBars: true
};

let horizontalSliderProps = {
  name: 'horizontalSlider1',
  scrollSpeed: 500,

  // infinite scrolling!
  infinite: true,
  resetSlides: false,
  scrollSensitivity: 2,
  touchSensitivity: 2
};

<Fullpage {...fullPageOptions} >
  <Slide> Slide 1 </Slide>

  <HorizontalSlider {...horizontalSliderProps} >
    <Slide> Slide 2.1 </Slide>
    <Slide> Slide 2.2 </Slide>
  </HorizontalSlider>

  <Slide> Slide 3 </Slide>
</Fullpage>
Event Triggers & Callbacks

The Fullpage Component takes 2 optional event callback functions, each function returns the slide name, whether it's the overally Fullpage slider which is triggered via Vertical slides. Or one of various horizontal sliders you choose to use.

Example here

<Fullpage onSlideChangeStart={this.onSlideChangeStart} onSlideChangeEnd={this.onSlideChangeEnd} >
</Fullpage>

There are also 2 functions that are used for non scroll based slide delegation. These each take a slide number or the arguments NEXT or PREV which will make the slider act accordingly

Example here

const {changeHorizontalSlide, changeFullpageSlide} = require('fullpage-react');

let prevSlide = changeFullpageSlide.bind(null, 'PREV');
let nextSlide = changeFullpageSlide.bind(null, 'NEXT');
let backToTop = changeFullpageSlide.bind(null, 0);

let topNavStyle = {
  textAlign: 'center',
  position: 'fixed',
  width: '100%',
  cursor: 'pointer',
  zIndex: 10,
  backgroundColor: 'rgba(255, 255, 255, 0.4)',
  top: '0px'
};

let topNav = (
  <Overlay style={topNavStyle}>
    <Tappable onTap={prevSlide}>
      <button>Previous Slide</button>
    </Tappable>
    <Tappable onTap={backToTop}>
      <button>Back to Top</button>
    </Tappable>
    <Tappable onTap={nextSlide}>
      <button>Next Slide</button>
    </Tappable>
  </Overlay>
);

<Fullpage onSlideChangeStart={this.onSlideChangeStart} onSlideChangeEnd={this.onSlideChangeEnd} >
  {topNav}
  <Slide>1</Slide>
  <Slide>2</Slide>
  <Slide>3</Slide>
</Fullpage>

######Overlay Component

This component is completely optional, but it provides some styling and helpers in order to provide overlaying nav bars, for example

let topNavStyle = {
  textAlign: 'center',
  position: 'fixed',
  width: '100%',
  cursor: 'pointer',
  zIndex: 10,
  backgroundColor: 'rgba(255, 255, 255, 0.4)',
  top: '0px'
};

let topNav = (
  <Overlay style={topNavStyle}>
    <Tappable onTap={prevSlide}>
      <button>Previous Slide</button>
    </Tappable>
    <Tappable onTap={backToTop}>
      <button>Back to Top</button>
    </Tappable>
    <Tappable onTap={nextSlide}>
      <button>Next Slide</button>
    </Tappable>
  </Overlay>
);

<Fullpage {...fullPageOptions}>

  {topNav}

  <Slide>
    <p>Slide 1</p>
  </Slide>

</Fullpage>