Optionalprops: IScrollProgressStaticProps & IScrollProgressMutableProps & Partial<OptionalonCallbacks: Partial<Retrieves the module's callbacks instance.
Calculates the progress of the section entering the root element.
Checks if the module has been destroyed.
Indicates whether the section is currently visible within the viewport or root element.
Calculates the progress of the section's movement within the root element.
The name of the module, derived from the class name
Calculates the progress of the section leaving the root element.
Optional prefix for classnames used by the module
Calculates the global scroll progress of the section relative to the root element.
Current properties. Do not mutate these directly, use updateProps instead.
The bounds of the root element used for scroll calculations.
Returns the section element being tracked for scroll progress.
The bounds of the section element relative to the root element.
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_destroyInternal method to handle the destruction of the module. It removes all callbacks, destroys properties, and cleans up event listeners and class names.
Retrieves the default mutable properties.
Retrieves the default static properties.
If true, progress is calculated only while the section is within the viewport or the root element.
Improves performance by avoiding unnecessary calculations.
The root element used as a reference for scroll progress calculation.
Usually it is the scroll container.
If null, the viewport is used as the reference.
The element whose scroll progress is tracked.
If true, the scroll progress is calculated based on the small viewport height (svh in css) instead of the current viewport height (vh in css).
Protected_handleMethod that is called when the module's properties mutate. In most cases, used to handle callbacks.
Destroys the module, cleaning up resources, callbacks, and event listeners.
Calculates the section scroll progress relative to the root element.
The function takes top or left corner of the section as the reference point.
Top threshold of the section position.
Right threshold of the section position.
Bottom threshold of the section position.
Left threshold of the section position.
The scroll progress along the x and y axes.
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.
Updates the section and root bounds, and emits an update callback.
Change module's mutable properties
ScrollProgressis a component that tracks the scroll progress of a specified section element.This component can be used for creating scroll-based animations such as parallax effects.
Documentation