Window scrollBy() 方法
Window 对象
定义和用法
scrollBy() 方法可把内容滚动指定的像素数。
注意: 要使此方法工作 window 滚动条的可见属性必须设置为true!
语法
参数 |
描述 |
xnum |
必需。把文档向右滚动的像素数。 |
ynum |
必需。把文档向下滚动的像素数。 |
浏览器支持





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