Function use_element_visibility

Source
pub fn use_element_visibility<El, M>(target: El) -> Signal<bool>
Expand description

Tracks the visibility of an element within the viewport.

§Demo

Link to Demo

§Usage

let el = NodeRef::<Div>::new();

let is_visible = use_element_visibility(el);

view! {
    <div node_ref=el>
        <h1>{is_visible}</h1>
    </div>
}

§Server-Side Rendering

On the server this returns a Signal that always contains the value false.

§See also