https://github.com/ericvaladas/anchor-offset
Offset scroll position for page anchors
https://github.com/ericvaladas/anchor-offset
Last synced: about 1 month ago
JSON representation
Offset scroll position for page anchors
- Host: GitHub
- URL: https://github.com/ericvaladas/anchor-offset
- Owner: ericvaladas
- Created: 2017-09-22T08:29:37.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-22T06:10:02.000Z (over 8 years ago)
- Last Synced: 2024-04-27T08:02:45.174Z (about 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# anchor-offset
Offset scroll position for page anchors.
[](https://badge.fury.io/js/anchor-offset)
[](https://travis-ci.org/ericvaladas/anchor-offset)
[](https://coveralls.io/github/ericvaladas/anchor-offset?branch=master)
[](https://david-dm.org/ericvaladas/anchor-offset)
[](https://david-dm.org/ericvaladas/anchor-offset?type=dev)
Useful for websites that have fixed content at the top of the page, such as a navigation bar.
## Usage
`anchorOffset(offset)`
| Argument | Default | Description |
| --- | --- | --- |
| offset | `0` | The amount to offset in pixels. |
### Node
Install the package with npm.
```sh
npm install --save anchor-offset
```
Import the anchor-offset module.
```js
import anchorOffset from 'anchor-offset';
anchorOffset(50);
```
### Web
Get the latest [release](https://github.com/ericvaladas/anchor-offset/releases) and include it in your page.
```html
anchorOffset(50);
```