Skip to main content

Module near_viewport

Module near_viewport 

Source
Expand description

元素接近视口的单向可见性激活 Hook(use_near_viewport)。 元素接近视口的单向可见性激活。

Functions§

use_near_viewport
观察指定 id 的元素是否进入「视口 + 提前量」范围;一旦相交就把返回的信号置为 true 并停止观察(单向激活,滚出视口不回退——调用方负责激活后的资源生命周期)。