js scrollIntoView

2022-05-07

以下示例是关于Javascript中包含js scrollIntoView用法的示例代码,想了解js scrollIntoView的具体用法?js scrollIntoView怎么用?js scrollIntoView使用的例子?那么可以参考以下相关源代码片段来学习它的具体使用方法。

[英]:js scrollIntoView源码类型:Javascript
const options = {
  inline: 'start',
  block: 'start',
  behavior: 'smooth'
}

htmlDiv.scrollIntoView(options)

/*
- behavior Optional
Defines the transition animation. One of auto or smooth. Defaults to auto.

- block Optional
Defines vertical alignment. One of start, center, end, or nearest.
Defaults to start.

- inline Optional
Defines horizontal alignment. One of start, center, end, or nearest. 
Defaults to nearest.
*/

本文地址:https://www.itbaoku.cn/snippets/785289.html