Git Product home page Git Product logo

parallax.js's Introduction

Parallax.js

Allow programming parallax effects in a declarative style.
Using plain object config to describe animations.
Provide smooth scrolling and compatibility with MacOS-like inertial scrolling.

VanillaJS powered; does not depend on any JavaScript libraries.

In gh-pages branch you can find example of use config files and simple realtime editor.

Support

Internet Explorer 9+
Safari 5.1.4+
Opera 12+ (probably 11.60+)
Firefox 4+
Chrome 7+

In older browsers try to use ES5 polyfills.

Usage

parallax = new Parallax({
    cfg             : {Object},
    auto            : {boolean},
    root            : {window|HTMLElement},
    beforeRender    : {Function},
    afterRender     : {Function},
    onElementCreate : {Function},
    onElementShow   : {Function},
    onWindowResize  : {Function}
});

cfg - object containing information about how animation and positions of html element correlate to scrolling progress.

auto - set true to autostart parallax.

root - describe root element for parallax's DOM tree. Currently supports only window as root element.

beforeRender and afterRender - functions calls every time parallax core want to render something.
Callback arguments:
progress {number} current scroll progress
speed {number} current scrolling speed

onElementCreate - calls on creating of element, once for element.
Callback arguments:
element {Parallax.Element} created element, contains its DOM at 'html' property
progress {number} current scroll progress

onElementShow - calls every time on showing of element (when 'display' switched from 'none' to something truthy).
Callback arguments:
element {Parallax.Element} created element, contains its DOM at 'html' property
progress {number} current scroll progress

API

parallax.setProgress({number})

manually set progress.

parallax.start()

use this if you set autostart to false.

parallax.stop()

stops the parallax reflows and rendering.

Feel free to use under MIT license.

parallax.js's People

Contributors

adagen avatar

Watchers

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