Giter VIP home page Giter VIP logo

react-parallax's Introduction

react-parallax

A react component for simple parallax effect

Install

npm install react-parallax --save-dev

Usage

var Parallax = require('react-parallax');

var TheContainer = React.createClass({
  render: function () {
    return (
      <div>
      	<Parallax bgImage="assets/1.jpg" strength={300}>
			<h1>first parallax section</h1>
			<h2>with some crazy text</h2>
			<br/>
			<h2>it's just there to fill the website</h2>
			<br/>
		</Parallax>
		<Parallax bgColor="white">
			<br/>
			<h1>second parallax is without bg image</h1>
			<br/>
		</Parallax>
		<Parallax bgImage="assets/2.jpg">
			<br/>
			<h1>its the third</h1>
			<br/>
			<h2>hello hello</h2>
			<br/>
		</Parallax>
      </div>
    )
  }
});

Props

  • bgImage: path to the background image that makes parallax effect visible - (type: String)
  • bgColor: css value for a background color (visible only if bgImage is NOT set), eg.: #ddd, yellow, rgb(34,21,125) - (type: String)
  • strength: parallax effect strength (in pixel), default 100. this will define the amount of pixels the background image is translated - (type: Number)
  • blur: pixel value for background image blur, default: 0 - (type: Number)
  • disabled: turns off parallax effect if set to true, default: false - (type: Boolean)

Children

The children are used to display any content inside the react-parallax component

Development

Initial set up, run:

npm install

For watch on files, live reload, JSX transpiling and browserify, run:

grunt

Port on Windows is 80, 8080 on all other OS by default. Can be set with option -port=8080

License

MIT

react-parallax's People

Watchers

James Cloos avatar Lindsay 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.