scrollBy()
は Element
インターフェイスのメソッドで、指定された量だけ要素をスクロールします。
構文
element.scrollBy(x-coord, y-coord); element.scrollBy(options)
引数
例
// 要素をスクロール
element.scrollBy(300, 300);
options
を使用する場合:
element.scrollBy({
top: 100,
left: 100,
behavior: 'smooth'
});
仕様書
仕様書 | 状態 | 備考 |
---|---|---|
CSS Object Model (CSSOM) View Module element.scrollBy() の定義 |
草案 | 初回定義 |
ブラウザーの互換性
BCD tables only load in the browser