scrollTo
Start from API_LEVEL
2.0. Please refer to API_LEVEL.
Scroll the page to the specified position.
Type
function scrollTo(option: Option): void
Simplified calling method
function scrollTo(y: number): void
Parameters
Option
| Property | Type | Required | DefaultValue | Description | API_LEVEL |
|---|---|---|---|---|---|
| y | number | Y | - | The vertical axis coordinates of the page, the 12 o'clock direction of the watch is positive, and scrolling down is negative | 2.0 |
| animConfig | animConfig | N | - | Scroll animation configuration | 3.6 |
animConfig
| Property | Type | Required | DefaultValue | Description | API_LEVEL |
|---|---|---|---|---|---|
| anim_rate | string | N | - | Animation curve, optional values linear, easein, easeout, easeinout refer to https://easings.net/ | 3.6 |
| anim_duration | number | N | - | Animation duration, in milliseconds | 3.6 |
| anim_fps | number | N | 25 | Animation frame rate | 3.6 |
| anim_complete_func | () => void | N | - | End of animation callback function | 3.6 |
Example
import { scrollTo } from '@zos/page'
scrollTo({
y: -200,
})