Skip to content

Commit 6dddd96

Browse files
committed
Update readme with site links to avoid outdated documentation
1 parent 1c0e241 commit 6dddd96

File tree

1 file changed

+5
-121
lines changed

1 file changed

+5
-121
lines changed

README.md

Lines changed: 5 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -14,131 +14,15 @@ Check out the [live demo](http://pushinjs.com/) for a working example.
1414

1515
## Compatibility
1616

17-
PushIn.js supports all browsers that are [ES5-compliant](http://kangax.github.io/compat-table/es5/) (IE8 and below are not supported).
17+
PushIn.js supports all browsers that are [ES5-compliant](http://kangax.github.io/compat-table/es5/).
1818

19-
## Getting started
19+
## Installation
2020

21-
### 1. Install pushin with NPM or a CDN
21+
PushIn is available via NPM or a CDN. Follow the detailed instructions in the documentation site: https://pushinjs.com/installation.
2222

23-
If you're using npm, you can install the package by running:
23+
## Configuration
2424

25-
```
26-
npm install --save pushin
27-
```
28-
29-
Import assets into your javascript (if using Webpack) or directly into your CSS files.
30-
31-
```js
32-
// webpack
33-
import 'pushin/dist/pushin.css';
34-
```
35-
36-
~ _or_ ~
37-
38-
```css
39-
/* css */
40-
@import 'node_modules/pushin/dist/pushin.css';
41-
```
42-
43-
**Alternatively, you can use the CDN:**
44-
45-
```html
46-
<link rel="stylesheet" href="https://unpkg.com/pushin/dist/pushin.min.css" />
47-
<script
48-
type="text/javascript"
49-
src="https://unpkg.com/pushin/dist/umd/pushin.min.js"
50-
></script>
51-
```
52-
53-
### 2. Required HTML structure
54-
55-
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-
<div class="pushin">
63-
<div class="pushin-scene">
64-
<div class="pushin-layer">This is the first layer you'll see.</div>
65-
<div class="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-
const container = document.querySelector('.pushin');
84-
new PushIn(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:
109-
110-
```jsx
111-
import React, { useLayoutEffect, useRef } from 'react';
112-
import { PushIn } from 'pushin';
113-
114-
export default function PushInComponent() {
115-
const pushInContainer = useRef();
116-
117-
useLayoutEffect(() => {
118-
const pushIn = new PushIn(pushInContainer.current);
119-
pushIn.start();
120-
121-
return () => pushIn.destroy();
122-
});
123-
124-
return (
125-
<div className="pushin" ref={pushInContainer}>
126-
<div className="pushin-scene">
127-
<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.
14226

14327
## Contributing
14428

0 commit comments

Comments
 (0)