This API is used via wx.pageScrollTo(Object object).
Attribute | Type | Default value | Required | Description |
scrollTop | number | - | Yes | Scroll to the target position on the page, measured in pixels. |
duration | number | 300 | No | Duration of the scrolling animation, measured in milliseconds. |
success | function | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Failing Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
wx.pageScrollTo({scrollTop: 0,duration: 300})
Attribute | Type | Description |
scrollEnabled | boolean | Scrolling Switch |
bounces | boolean | Set the scroll boundary elasticity (currently unsupported) |
showScrollbar | boolean | Set the visibility of the scrollbar |
pagingEnabled | boolean | Pagination Slide Switch |
fastDeceleration | boolean | Set scroll deceleration rate (iOS only) |
decelerationDisabled | boolean | Cancel the scroll inertia (Effective only on iOS) |
wx.createSelectorQuery().select('#scrollview').node().exec((res) => {const scrollView = res[0].node;scrollView.scrollEnabled = false;})
The method is used via: ScrollViewContext.scrollIntoView(string selector, object ScrollIntoViewOptions)
The method is used via ScrollViewContext.scrollTo(Object object)
Attribute | Type | Default value | Required | Description |
top | number | - | No | Top distance |
left | number | - | No | Left Boundary Distance |
velocity | number | - | No | Initial Speed (iOS only) |
duration | number | - | No | Scroll animation length (iOS only) |
animated | boolean | - | No | Enable scroll animation or not |
Was this page helpful?