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
At the most basic level, there are a few things you need to set up on your page in order for this to work properly.
56
-
57
-
Use the following example snippet to create a "scene" for the pushin effect.
58
-
59
-
**Example:**
60
-
61
-
```html
62
-
<divclass="pushin">
63
-
<divclass="pushin-scene">
64
-
<divclass="pushin-layer">This is the first layer you'll see.</div>
65
-
<divclass="pushin-layer">
66
-
This is a second layer, which will be positioned behind the first one.
67
-
</div>
68
-
</div>
69
-
</div>
70
-
```
71
-
72
-
Each div with the class `pushin-layer` can hold the content that you want to grow or shrink when scrolling.
73
-
74
-
### 3. Initialize the effect
75
-
76
-
Once you have your HTML set up, there are two ways to initialize the effect:
77
-
78
-
- call `new PushIn().start()`:
79
-
80
-
```js
81
-
import { PushIn } from'pushin';
82
-
83
-
constcontainer=document.querySelector('.pushin');
84
-
newPushIn(container).start();
85
-
```
86
-
87
-
- call `pushInStart()` function (which is exported onto the global scope):
88
-
89
-
```js
90
-
import'pushin';
91
-
92
-
pushInStart();
93
-
```
94
-
95
-
To assist in setting up your effect, you can use the debug tool to easily deterimine where you want effects to begin and end when scrolling down your page. To enable this feature, simply pass a config object with `debug: true` into the helper function.
96
-
97
-
See a working demo of this tool here: [Responsive design](https://pushinjs.com/examples/responsive)
98
-
99
-
```js
100
-
import'pushin';
101
-
102
-
// initialize push-in effect
103
-
pushInStart({ debug:true });
104
-
```
105
-
106
-
### 4. Destroying the effect
107
-
108
-
The `PushIn` has a `destroy()` method that may be called to do all cleanups once the view is destroyed. For instance, this is how you would want to do this in React:
<div className="pushin-layer">This is the first layer you'll see.</div>
128
-
<div className="pushin-layer">
129
-
This is a second layer, which will be positioned behind the first one.
130
-
</div>
131
-
</div>
132
-
</div>
133
-
);
134
-
}
135
-
```
136
-
137
-
### 5. Configuration
138
-
139
-
There are several plugin configurations you can use to customize for your unique project.
140
-
141
-
**Refer to [https://pushinjs.com/api](https://pushinjs.com/api) for a detailed breakdown of all available configurations.**
25
+
There are several plugin configurations you can use to customize for your unique project. Refer to [https://pushinjs.com/api](https://pushinjs.com/api) for a detailed breakdown of all available configurations.
0 commit comments