Optional
props: StaticProps & MutablePropsProtected
_callbacksCallbacks instance
Protected
_destroyableStores actions that need to be executed when the module is destroyed
Protected
_isTracks whether the module has been destroyed
Protected
_isIndicates whether the section is currently visible within the viewport or root element.
Protected
_propsCurrent properties
Protected
_rootThe bounds of the root element used for scroll calculations.
Protected
_sectionThe bounds of the section element relative to the root element.
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.
Protected
_handleMethod that is called when the module's properties mutate. In most cases, used to handle callbacks.
Protected
_setupSets up events
Protected
_setupSets up an IntersectionObserver
to track the visibility of the section.
Protected
_setupSets up a scroll event listener to track and update progress.
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.
ScrollProgress
is 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