阅读(845) 赞(3)

window方法:scrollByPages()

2018-09-20 13:59:21 更新

scrollByPages()方法

注意:此功能是非标准的,不要在面向Web的生产站点上使用它,它不适用于每个用户。实现之间可能存在很大的不兼容性,并且行为可能在将来发生变化。

scrollByPages()方法按指定的页数滚动当前文档。

scrollByPages()方法语法

window.scrollByPages(pages)

参数

  • pages是要滚动的页数,可以是正整数或负整数。

示例

// scroll down the document by 1 page 
window.scrollByPages(1);

// scroll up the document by 1 page 
window.scrollByPages(-1);

规范

DOM级别0.不属于规范。

浏览器兼容性

电脑端 移动端
Chrome
Edge
Firefox
Internet Explorer
Opera
Safari
Android webview Chrome for Android
Edge Mobile Firefox for Android
Opera for Android
iOS Safari
基本支持
(非标准)
不支持 ? 支持 ? ? 不支持 不支持 不支持 ? 不支持 ? 不支持