Giter Club home page Giter Club logo

react-page-slides's Introduction

Build Status

react-page-slides

React component for creating fullscreen scrolling websites with parallax effect. Supports Typescript.

Installation

npm install --save react-page-slides

Demo

Click here

Usage

import React from 'react';
import {ISlideConfig, PageSlides, SlideParallaxType} from 'react-page-slides';

export const MainPage = () => {
    const slides: ISlideConfig[] = [
        {
            content: <div>first page content</div>,
            style: {
                backgroundImage: 'url("public/photo/photo_1.jpg")'
            }
        },
        {
            content: <div>second page content</div>,
            style: {
                backgroundImage: 'url("public/photo/photo_2.jpg")'
            }
        },
        {
            content: <div>third page content</div>,
            style: {
                backgroundImage: 'url("public/photo/photo_2.jpg")'
            }
        },
    ];
    return (
        <PageSlides
            enableAutoScroll={true}
            transitionSpeed={1000}
            slides={slides}
            parallax={{
                offset: 0.6,
                type: SlideParallaxType.reveal
            }}
        />
    )
};

Props

  • enableAutoScroll - scroll slides automatically or not
  • transitionSpeed - speed of scrolling in milliseconds when using enableAutoScroll = true
  • slides - array of configurations of slides. Configurations must implement interface ISlideConfig
interface ISlideConfig {
    content: any; // content of slide.
    style: CSSProperties //css properties. can be using for setting of background to slide.
}
  • parallax - parallax settings. Takes two options - offset of parallax (allows float values from 0 to 1) and type ('reveal' or 'cover');
  • currentSlideIndex - can be using for scrolling to particular slide (allows integer values from 0 to slides.length - 1). You can use it with react-router.
  • onChange - subscribe to change slide event. first parameter of callback - index of current slide.

react-page-slides's People

Contributors

wermetal avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.