Scroll API
Programmatically scroll the page to bring elements into view.
The scroll API provides smooth scroll-to-target functionality. Access it through instance.scroll.
Properties
| Property | Type | Description |
|---|---|---|
isScrolling | boolean | Whether a scroll animation is currently in progress |
isLocked | boolean | Whether manual page scroll is currently blocked |
Methods
| Method | Description |
|---|---|
scrollTo(element) | Scroll to bring an element into view. Resolves when animation finishes. |
Usage
// Scroll to a specific element
await instance.scroll.scrollTo(document.getElementById('target'));
// Check if scrolling
if (instance.scroll.isScrolling) {
console.log('Scroll animation in progress');
}
When scroll: false is set in config, scrollTo becomes a no-op that resolves immediately.
When animation.isEnabled is false globally, scroll still runs but becomes an instant jump regardless of the configured duration.