阅读(3730) 赞(3)

window方法:scrollByLines()

2018-09-19 14:29:34 更新

scrollByLines()方法

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

scrollByLines()方法按给定的行数滚动文档。

scrollByLines()方法语法

window.scrollByLines(lines) 

参数

  • lines是滚动文档的行数。
  • lines可以是正整数或负整数。

示例

<!-- scroll down the document by 5 lines. -->
<button onclick="scrollByLines(5);">down 5 lines</button>
<!-- scroll up the document by 5 lines. -->
<button onclick="scrollByLines(-5);">up 5 lines</button>

规范

这不是任何规范的一部分

浏览器兼容性

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