pub struct UseIntersectionObserverOptions<El, T>{ /* private fields */ }
Expand description
Options for use_intersection_observer_with_options
.
Implementations§
source§impl<El, T> UseIntersectionObserverOptions<El, T>
impl<El, T> UseIntersectionObserverOptions<El, T>
sourcepub fn immediate(self, value: bool) -> Self
pub fn immediate(self, value: bool) -> Self
If true
, the IntersectionObserver
will be attached immediately. Otherwise it
will only be attached after the returned resume
closure is called. That is
use_intersections_observer
will be started “paused”.
sourcepub fn root<New__El, New__T>(
self,
value: Option<New__El>
) -> UseIntersectionObserverOptions<New__El, New__T>
pub fn root<New__El, New__T>( self, value: Option<New__El> ) -> UseIntersectionObserverOptions<New__El, New__T>
A web_sys::Element
or web_sys::Document
object which is an ancestor of the intended target
,
whose bounding rectangle will be considered the viewport.
Any part of the target not visible in the visible area of the root
is not considered visible.
Defaults to None
(which means the root document
will be used).
Please note that setting this to a Some(document)
may not be supported by all browsers.
See Browser Compatibility
sourcepub fn root_margin(self, value: impl Into<String>) -> Self
pub fn root_margin(self, value: impl Into<String>) -> Self
A string which specifies a set of offsets to add to the root’s bounding box
when calculating intersections, effectively shrinking or growing the root for calculation purposes. The syntax is approximately the same as that for the CSS
margin
property; see
The intersection root and root margin
for more information on how the margin works and the syntax. The default is "0px"
.
sourcepub fn thresholds(self, value: Vec<f64>) -> Self
pub fn thresholds(self, value: Vec<f64>) -> Self
A Vec
of numbers between 0.0 and 1.0, specifying a ratio of intersection area to total
bounding box area for the observed target. A value of 0.0 means that even a single
visible pixel counts as the target being visible. 1.0 means that the entire target
element is visible. See Thresholds
for a more in-depth description of how thresholds are used.
The default is a single threshold of [0.0]
.
Trait Implementations§
Auto Trait Implementations§
impl<El, T> Freeze for UseIntersectionObserverOptions<El, T>where
El: Freeze,
impl<El, T> RefUnwindSafe for UseIntersectionObserverOptions<El, T>where
El: RefUnwindSafe,
T: RefUnwindSafe,
impl<El, T> Send for UseIntersectionObserverOptions<El, T>
impl<El, T> Sync for UseIntersectionObserverOptions<El, T>
impl<El, T> Unpin for UseIntersectionObserverOptions<El, T>
impl<El, T> UnwindSafe for UseIntersectionObserverOptions<El, T>where
El: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more