relativeTo 方法可以被用来指定参照节点,参照节点根据 id 指定,参照节点的视窗可以根据 margins 进行缩放。
relativeTo
id
margins
relativeTo( selector: string, margins ? margins : {left: 0, right: 0, top: 0, bottom: 0} ): IntersectionObserver;
selector: string;
指定查找参照节点时使用的 id,优先在创建 IntersectionObserver 对象时传入的 component 中查找,查找不到再进行全局查找,全局查找不到则以 LynxView 作为参照节点。
IntersectionObserver
component
LynxView
margins ? margins : { left: 0, right: 0, top: 0, bottom: 0 };