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