Initializes the InView module.
Optionalprops: IInViewStaticProps & IInViewMutableProps & Partial<OptionalonCallbacks: Partial<Retrieves the module's callbacks instance.
Returns all elements currently being observed.
Checks if the module has been destroyed.
Indicates whether the observation has started for the first time.
The name of the module, derived from the class name
Optional prefix for classnames used by the module
Current properties. Do not mutate these directly, use updateProps instead.
Protected_addAdds a class name on an element, and keeps track of it for removal when the module is destroyed.
The target DOM element.
The class name to toggle.
Protected_cnHelper function to generate classnames with the module's prefix.
The class names to generate.
A string of class names with the module's prefix applied.
Protected_destroyCleans up the module and disconnects all observers and listeners.
Returns default mutable properties.
Enables or disables the IntersectionObserver instance.
Specifies the root margin offsets for the IntersectionObserver, allowing fine-tuned visibility detection.
Returns default static properties.
Determines whether elements leaving the viewport should trigger an event.
Sets the maximum delay (in milliseconds) for initial element visibility. Delay is calculated based on element position.
Defines the primary scrolling axis used for delay calculations.
Protected_handleHandles property mutations and updates observation events accordingly.
Registers an element for visibility observation.
If the element has a data-in-view-class attribute, the specified class will be applied upon entering the viewport.
A function to stop observing the element.
Destroys the module, cleaning up resources, callbacks, and event listeners.
Adds a custom callback to the module.
The event type to listen for (e.g., 'props', 'destroy').
The function to execute when the event is triggered.
Additional settings for the callback.
Adds a callback on the module's destruction.
The function to execute during destruction.
Removes an element from observation, preventing further visibility tracking.
InView is a visibility detection utility that leverages the
IntersectionObserverAPI to monitor when elements enter or leave the viewport. It provides customizable options for triggering events, delaying visibility changes, and dynamically adding CSS classes to elements based on their visibility state.Documentation