0.2.6 • Published 8 years ago

react-simple-parallax v0.2.6

Weekly downloads
11
License
MIT
Repository
github
Last release
8 years ago

react-simple-parallax

A simple React Component for parallax effect on the front layer.

alt tag

Install

npm install -S react-simple-parallax

Usage

import Parallax from 'react-simple-parallax';

class App extends React.Component {
  render () {
	return (
		<section>
		  	<Parallax className="parallax" speedDivider="5">
		  		<div>Hello World!</div>
		  	</Parallax>
		</section>
	);
  }
}

Basic styling

    section {
        text-align: center;
    }
    
    /* .react-simple-parallax-bg is generate by the component */
    section .react-simple-parallax-bg {
        background-image: url('http://tinyurl.com/zaz7bp4');
        height: 750px;
    }
    
    section .parallax {
        top: 200px;
        margin: auto;
    }

Attributes

  • speedDivider: controle translation speed (default: 5)
  • backgroundStyle: to set the style of the background element with a javascript object (optional)

Example

  render () {
	var background = {
		height: "1000px",
		backgroundImage: 'url(http://tinyurl.com/zaz7bp4)'
	}
	return (
		<section>
		  	<Parallax speedDivider="3" backgroundStyle={background}>

Build the exemple

Initial set up

npm install

Install Webpack

npm install webpack -g

Build the exemple

webpack

Open /src/index.html

License

MIT

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago