scrollTop parameter has a higher priority than selector.
Parameters
Code Example
Related APIs
my.createSelectorQuery
Query DOM elements
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Scroll the page to a specified position.
scrollTop parameter has a higher priority than selector.
| Property | Type | Required | Description |
|---|---|---|---|
| scrollTop | Number | No | Scroll to target position in px. Must be greater than 0 when jumping to top. |
| duration | Number | No | Duration of scroll animation, in ms (default: 0) |
| selector | String | No | Selector. Framework executes document.querySelector(selector). |
| success | Function | No | Callback on success |
| fail | Function | No | Callback on failure |
| complete | Function | No | Callback that always executes |
// Scroll to top
my.pageScrollTo({
scrollTop: 0,
duration: 300
});
// Scroll to element
my.pageScrollTo({
selector: '#target-element'
});