1.1.3 • Published 6 years ago

custom-properties-parallax v1.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

custom-properties-parallax

Build Status

Parallax effect using custom properties - Inspired by Cheapass Parallax - daverupert.com

Installation

# npm
npm install custom-properties-parallax --save

# Yarn
yarn add custom-properties-parallax

esnext

import 'custom-properties-parallax';

ES5

<script src="node_modules/custom-properties-parallax/dist/custom-properties-parallax.js"></script>

Usage

  • Add data-cpp attributes to each of the elements that require a parallax effect on initialisation
  • Declare any of the following custom properties in the :root pseudo-class to override library defaults:

    NameTypeDefault
    --cpp-distanceUnit0.625rem
    --cpp-speedNumber0.5
  • For individual control, leverage the cascade by declaring any of the above custom properties within the CSS selectors of the target elements. For example:

    h1 {
      --cpp-speed: 1;
    }
  • Use the create method to apply the parallax effect to an element after initialisation. For example:

    const h1 = document.querySelector('h1');
    CustomPropertiesParallax.create(h1);
1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago