tencent cloud

All product documents
Tencent Cloud Super App as a Service
Last updated: 2024-11-21 18:41:53
Scroll
Last updated: 2024-11-21 18:41:53

pageScrollTo

This API is used via wx.pageScrollTo(Object object).
Feature Description: Scrolls the page to the desired location.
Parameter and Description: 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)
Sample Code
wx.pageScrollTo({
scrollTop: 0,
duration: 300
})

ScrollViewContext

Feature Description: Enhances ScrollView instance, which can be obtained through the wx.createSelectorQuery's NodesRef.node method. Effective only when the scroll-view component's enhanced attribute is enabled.
Attribute and Descriptions
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)
Sample Code
wx.createSelectorQuery()
.select('#scrollview')
.node()
.exec((res) => {
const scrollView = res[0].node;
scrollView.scrollEnabled = false;
})

.scrollIntoView

The method is used via: ScrollViewContext.scrollIntoView(string selector, object ScrollIntoViewOptions)
Feature Description: Scrolls to the specified position.
Parameters and Description: string selector, element selector.

.scrollTo

The method is used via ScrollViewContext.scrollTo(Object object)
Feature Description: Scrolls to the specified position.
Parameter and Description: 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?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon