Skip to content

Commit

Permalink
feat(api): rename API for distance custom property
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Finney committed Mar 31, 2018
1 parent 457fab6 commit d2b49ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import 'custom-properties-parallax';

| Name | Type | Default |
| ---------------- | ------ | -------- |
| `--cpp-modifier` | Unit | 0.625rem |
| `--cpp-distance` | Unit | 0.625rem |
| `--cpp-speed` | Number | 0.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:
Expand Down
4 changes: 2 additions & 2 deletions src/parallax/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
*/

const DEFAULT_VALUES = {
MODIFIER: '.0625rem',
DISTANCE: '.0625rem',
SPEED: 0.5,
};

const NAMESPACE = 'cpp';

const CUSTOM_PROPERTIES = {
MODIFIER: `--${NAMESPACE}-modifier`,
DISTANCE: `--${NAMESPACE}-distance`,
PARALLAX: `--${NAMESPACE}-parallax`,
SPEED: `--${NAMESPACE}-speed`,
};
Expand Down
2 changes: 1 addition & 1 deletion src/parallax/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function create(parallaxElement) {
parallaxElement.style.setProperty(
'transform',
`translate3d(0, calc(var(${CUSTOM_PROPERTIES.PARALLAX}) * var(${
CUSTOM_PROPERTIES.MODIFIER
CUSTOM_PROPERTIES.DISTANCE
})), 0)`
);

Expand Down

0 comments on commit d2b49ae

Please sign in to comment.