You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ npm i react-scroll-parallax --save
20
20
21
21
## Usage
22
22
23
-
Import `ParallaxController` on the client side and call `ParallaxController.init()` to create the global `ParallaxController` which will handle updating all parallax elements on scroll.
23
+
Import `ParallaxController` on the client side and call `ParallaxController.init()` to create the global `ParallaxController`on the `window`which will handle controlling all parallax elements on scroll. Ideally, this would be called at the root of your react app on the client.
@@ -48,7 +48,7 @@ import { Parallax } from 'react-scroll-parallax';
48
48
</Parallax>
49
49
```
50
50
51
-
NOTE: `ParallaxController` caches the scroll state and positions of elements on the page for performance reasons. This means that if the page height changes (perhaps by images loading) after `<Parallax />` components are mounted it won't properly determine when the elements are in view. To correct this call the `update()` once every thing has loaded and ready.
51
+
**NOTE:**`ParallaxController` caches the scroll state and positions of elements on the page for performance reasons. This means that if the page height changes (perhaps from images loading) after `<Parallax />` components are mounted it won't properly determine when the elements are in view. To correct this call the `update()`from the global `ParallaxController`once every thing has loaded and is ready.
52
52
53
53
## Parallax Component Props
54
54
@@ -111,12 +111,14 @@ Optionally pass a tag name to be applied to the outer most parallax element. For
111
111
112
112
## Parallax Controller
113
113
114
-
The following are public methods available on the `ParallaxController` global:
115
-
116
114
**`init()`**
117
115
118
116
Initilize the `ParallaxController` on the client with the `init` static method.
119
117
118
+
**NOTE:** Calling `ParallaxController.init()` creates an instance of the controller on the `window` using the same name, e.g. `window.ParallaxController`.
119
+
120
+
The following are public methods available on the `window.ParallaxController` global:
121
+
120
122
**`update()`**
121
123
122
124
Updates all cached attributes for parallax elements then updates their positions.
0 commit comments