https://github.com/eclass/scrollmove
https://github.com/eclass/scrollmove
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/eclass/scrollmove
- Owner: eclass
- License: mit
- Created: 2019-11-12T20:23:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-19T11:55:32.000Z (over 1 year ago)
- Last Synced: 2024-11-19T12:54:06.887Z (over 1 year ago)
- Language: TypeScript
- Size: 327 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 41
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @eclass/scrollmove
[](https://www.npmjs.com/package/@eclass/scrollmove)
[](https://travis-ci.org/eclass/scrollmove)
[](https://www.npmjs.com/package/@eclass/scrollmove)
[](https://david-dm.org/eclass/scrollmove)
[](https://david-dm.org/eclass/scrollmove#info=devDependencies)
> Modulo para mover el scroll suave hasta centrar un elemento en pantalla
### 🏠 [Homepage](https://github.com/eclass/scrollmove#readme)
## Prerequisites
- node >=10.16.3
## Install
```sh
npm i @eclass/scrollmove
```
## Run tests
```sh
npm run test
```
## Example 📖
`goTo()` receives two parameters `id` and `options`
```js
import goTo from '@eclass/scrollmove'
...
goTo(`#question-98765`)}>
/>
```
```js
import goTo from '@eclass/scrollmove'
...
goTo(`#question-98765`, { behavior: 'smooth', block: 'center' })}>
/>
```
### Params
- id: string, that identifies the element in the dom.
- options: object, with the properties `behavior`, `block` and `inline`. Default is set `{ behavior: 'smooth', block: 'center' }`.
More options from api of [scrollIntoView](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView)
## Author
👤 **Ender Bonnet**
- Twitter: [@enBonnet](https://twitter.com/enbonnet)
- Github: [@enBonnet](https://github.com/enbonnet)
## 📝 License
Copyright © 2019 [Ender Bonnet (https://enbonnet.me/)](https://github.com/eclass).
This project is [MIT](https://github.com/eclass/scrollmove/blob/master/LICENSE) licensed.