最后更新于:2022-03-26 22:10:14
Window scrollTo() 方法
Window 对象
定义和用法
scrollTo() 方法可把内容滚动到指定的坐标。
语法
参数 |
描述 |
xpos |
必需。要在窗口文档显示区左上角显示的文档的 x 坐标。 |
ypos |
必需。要在窗口文档显示区左上角显示的文档的 y 坐标。 |
浏览器支持





所有主要浏览器都支持 scrollTo() 方法
实例
实例
滚动内容的坐标位置100,500:
function scrollWindow(){
window.scrollTo(100,500);
}
尝试一下 »
Window 对象