Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
markcellus committed May 5, 2022
1 parent c9fc9f6 commit 4f7bec8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,26 @@ You can install the library as a npm module by running the following command:
npm i scroll-js
```

Alternatively, you can simply download one of the distribution files (un-minified or minified version) in the dist folder (available when npm installed) and reference them directly in your html file.
## Importing

After installing, you can either `import` the component into your file:

```js
import { scrollTo, scrollIntoView } from 'scroll-js';
```

Or, you can reference any of the files made available in the dist folder in your html file.

```html
<script src="node_modules/scroll-js/dist/scroll.js"></script>
```

## Usage

In addition to the samples below, you can find more in the [examples](/examples) folder.

### Scrolling the window

```js
import { scrollTo } from 'scroll-js';

Expand All @@ -67,8 +79,6 @@ scrollTo(window, { top: 500 }).then(function () {
});
```

In addition to the samples below, you can find more in the [examples](/examples) folder.

### Scrolling an element

You can manually scroll any element on a page and optionally detect when done. Just make sure the element you want to scroll has:
Expand Down

0 comments on commit 4f7bec8

Please sign in to comment.