How to make the scroll, in better-scroll package back to the top.

how to make better-scroll encapsulated scroll, back to the top.

Mar.20,2021

method:
scrollTo (x, y, time, easing)
parameters:
{Number} x Abscissa coordinates (unit px)
{Number} y vertical axis coordinates (unit px)
{Number} time scrolling animation execution time (unit ms)
{Object} easing ease function. Generally, it is not recommended to modify it. If you want to modify it, refer to the ease.js in the source code

.

example:
this.scroll.scrollTo (0Magne0500)
/ / this.scroll is the instantiated BScroll object
/ / scrollTo () is the method
/ / (0meme0500) scrolls to the position at the top of the coordinate (0recover0) at a speed of 500ms.

Menu