blockly > utils > style > scrollIntoContainerView

utils.style.scrollIntoContainerView() 函数

container 的滚动位置更改为最小的距离,使给定 element 的内容和边框可见。如果元素大于容器,则其左上角会尽可能靠近容器的左上角。从 Closure 的 goog.style.scrollIntoContainerView 中复制

Signature:

export declare function scrollIntoContainerView(element: Element, container: Element, opt_center?: boolean): void;

参数

参数 类型 说明
元素 元素 要显示的元素。
容器 元素 要滚动的容器。如果未设置,系统将使用文档滚动元素。
opt_center boolean (可选)是否将元素居中放置在容器中。默认值为 false。

返回

void