mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
22 lines
423 B
TypeScript
22 lines
423 B
TypeScript
import scrollToElement from 'scroll-to-element';
|
|
|
|
scrollToElement('#id');
|
|
|
|
// with options
|
|
scrollToElement('.className', {
|
|
offset: 0,
|
|
ease: 'out-bounce',
|
|
duration: 1500
|
|
});
|
|
|
|
// or if you already have a reference to the element
|
|
const elem = document.querySelector('.className');
|
|
if (elem) {
|
|
scrollToElement(elem, {
|
|
offset: 0,
|
|
ease: 'out-bounce',
|
|
align: 'top',
|
|
duration: 1500
|
|
});
|
|
}
|