Skip to content

Commit cb4c7c8

Browse files
committed
Update installation instructions
1 parent 14ce0b3 commit cb4c7c8

File tree

1 file changed

+43
-30
lines changed

1 file changed

+43
-30
lines changed

README.md

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,38 @@ For last stable release (v2) go [here](https://github.com/michalsnik/aos/tree/v2
2626

2727
## ⚙ Installation
2828

29+
### Basic
30+
2931
Add styles in `<head>`:
3032

3133
```html
3234
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
3335
```
3436

35-
Add script right before closing `</body>` tag:
37+
Add script right before closing `</body>` tag, and initialize AOS:
3638
```html
3739
<script src="https://unpkg.com/aos@next/dist/aos.js"></script>
40+
<script>
41+
AOS.init();
42+
</script>
3843
```
3944

40-
You can also use:
45+
### Using package managers
4146

47+
Install `aos` package:
4248
* `yarn add aos@next`
43-
* `npm install --save aos@next`
49+
* or `npm install --save aos@next`
50+
51+
Import script, styles and initialize AOS:
52+
```js
53+
import AOS from 'aos';
54+
import 'aos/dist/aos.css'; // You can also use <link> for styles
55+
// ..
56+
AOS.init();
57+
```
58+
59+
In order to make it work you'll have to make sure your build process has configured styles loader, and bundles it all correctly.
60+
If you're using [Parcel](https://parceljs.org/) however, it will work out of the box as provided.
4461

4562
---
4663

@@ -49,30 +66,28 @@ You can also use:
4966

5067
### 1. Initialize AOS:
5168

52-
```html
53-
<script>
54-
AOS.init();
55-
56-
// You can also pass an optional settings object
57-
// below listed default settings
58-
AOS.init({
59-
// Global settings
60-
disable: false, // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function
61-
startEvent: 'DOMContentLoaded', // name of the event dispatched on the document, that AOS should initialize on
62-
initClassName: 'aos-init', // class applied after initialization
63-
animatedClassName: 'aos-animate', // class applied on animation
64-
useClassNames: false, // if true, will add content of `data-aos` as classes on scroll
65-
66-
// Settings that can be overriden on per-element basis, by `data-aos-*` attributes:
67-
offset: 120, // offset (in px) from the original trigger point
68-
delay: 0, // values from 0 to 3000, with step 50ms
69-
duration: 400, // values from 0 to 3000, with step 50ms
70-
easing: 'ease', // default easing for AOS animations
71-
once: false, // whether animation should happen only once - while scrolling down
72-
mirror: false, // whether elements should animate out while scrolling past them
73-
anchorPlacement: 'top-bottom', // defines which position of the element regarding to window should trigger the animation
74-
});
75-
</script>
69+
```js
70+
AOS.init();
71+
72+
// You can also pass an optional settings object
73+
// below listed default settings
74+
AOS.init({
75+
// Global settings
76+
disable: false, // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function
77+
startEvent: 'DOMContentLoaded', // name of the event dispatched on the document, that AOS should initialize on
78+
initClassName: 'aos-init', // class applied after initialization
79+
animatedClassName: 'aos-animate', // class applied on animation
80+
useClassNames: false, // if true, will add content of `data-aos` as classes on scroll
81+
82+
// Settings that can be overriden on per-element basis, by `data-aos-*` attributes:
83+
offset: 120, // offset (in px) from the original trigger point
84+
delay: 0, // values from 0 to 3000, with step 50ms
85+
duration: 400, // values from 0 to 3000, with step 50ms
86+
easing: 'ease', // default easing for AOS animations
87+
once: false, // whether animation should happen only once - while scrolling down
88+
mirror: false, // whether elements should animate out while scrolling past them
89+
anchorPlacement: 'top-bottom', // defines which position of the element regarding to window should trigger the animation
90+
});
7691
```
7792

7893
### 2. Set animation using `data-aos` attribute:
@@ -333,8 +348,6 @@ Example usage:
333348

334349
---
335350

336-
## ✌️ [Contributing](CONTRIBUTING.md)
337-
338351
## ❔Questions
339352

340-
If you have any questions, ideas or whatsoever, please check [AOS contribution guide](CONTRIBUTING.md) and don't hesitate to create new issues.
353+
If you found a bug, have a question or an idea, please check [AOS contribution guide](CONTRIBUTING.md) and don't hesitate to create new issues.

0 commit comments

Comments
 (0)