If you don't need the change to animate then you don't need to use any special plugins - I'd just use the native JavaScript window.scrollTo method -- passing in 0,0 will scroll the page to the top left instantly.
(如果您不需要更改以进行动画处理,则无需使用任何特殊的插件-我只使用本机JavaScript window.scrollTo方法-传入0,0即可将页面立即滚动到左上角。)
window.scrollTo(x-coord, y-coord);
Parameters
(参量)
- x-coord is the pixel along the horizontal axis.
(x坐标是沿水平轴的像素。)
- y-coord is the pixel along the vertical axis.
(y坐标是沿垂直轴的像素。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…