window方法:scrollByPages()

2018-09-20 14:06 更新

scrollByPages()方法

注意:此功能是非標(biāo)準(zhǔn)的,不要在面向Web的生產(chǎn)站點(diǎn)上使用它,它不適用于每個(gè)用戶。實(shí)現(xiàn)之間可能存在很大的不兼容性,并且行為可能在將來(lái)發(fā)生變化。

scrollByPages()方法按指定的頁(yè)數(shù)滾動(dòng)當(dāng)前文檔。

scrollByPages()方法語(yǔ)法

window.scrollByPages(pages)

參數(shù)

  • pages是要滾動(dòng)的頁(yè)數(shù),可以是正整數(shù)或負(fù)整數(shù)。

示例

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

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

規(guī)范

DOM級(jí)別0.不屬于規(guī)范。

瀏覽器兼容性

電腦端 移動(dòng)端
Chrome
Edge
Firefox
Internet Explorer
Opera
Safari
Android webview Chrome for Android
Edge Mobile Firefox for Android
Opera for Android
iOS Safari
基本支持
(非標(biāo)準(zhǔn))
不支持 ? 支持 ? ? 不支持 不支持 不支持 ? 不支持 ? 不支持
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)