use leptos::*; use leptos_use::docs::{demo_or_body, BooleanDisplay}; use leptos_use::{ use_intersection_observer_with_options, UseIntersectionObserverOptions, UseIntersectionObserverReturn, }; #[component] fn Demo(cx: Scope) -> impl IntoView { let root = create_node_ref(cx); let target = create_node_ref(cx); let (is_visible, set_visible) = create_signal(cx, false); let UseIntersectionObserverReturn { is_active, pause, resume, .. } = use_intersection_observer_with_options( cx, target, move |entries, _| { set_visible.set(entries[0].is_intersecting()); }, UseIntersectionObserverOptions::default().root(Some(root)), ); view! { cx,
"Scroll me down!"
"Hello world!"