Modulo para mover el scroll suave hasta centrar un elemento en pantalla
🏠 Homepage
- node >=10.16.3
npm i @eclass/scrollmovenpm run testgoTo() 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' })}>
/>- id: string, that identifies the element in the dom.
- options: object, with the properties
behavior,blockandinline. Default is set{ behavior: 'smooth', block: 'center' }.
More options from api of scrollIntoView
👤 Ender Bonnet
Copyright © 2019 Ender Bonnet [email protected] (https://enbonnet.me/).
This project is MIT licensed.