Skip to content

eclass/scrollmove

Repository files navigation

@eclass/scrollmove

npm Build Status downloads dependencies devDependency Status

Modulo para mover el scroll suave hasta centrar un elemento en pantalla

Prerequisites

  • node >=10.16.3

Install

npm i @eclass/scrollmove

Run tests

npm run test

Example 📖

goTo() receives two parameters id and options

import goTo from '@eclass/scrollmove'
...
<Component
  onClick={() => goTo(`#question-98765`)}>
/>
import goTo from '@eclass/scrollmove'
...
<Component
  onClick={() => 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

Author

👤 Ender Bonnet

📝 License

Copyright © 2019 Ender Bonnet [email protected] (https://enbonnet.me/).
This project is MIT licensed.