EveryDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/soyleninjs/hequalizer/llms.txt
Use this file to discover all available pages before exploring further.
Hequalizer instance exposes four public methods that cover the full lifecycle of a height-equalization group: initialization, manual recalculation, DOM re-querying, and teardown. Alongside those methods, the instance holds several readable properties that reflect the current state of the group — from the active breakpoint to the last set of calculated height values.
Methods
init()
Sets the active options and breakpoint for the current viewport, calculates maximum heights across all element groups, starts the window resize listener, attaches MutationObserver instances to each element, and emits the hequalizer:{handle}:init event.
Signature: instance.init(): void
init() is called automatically after document.fonts.ready resolves. You only need to call it manually if you deliberately deferred or skipped the automatic initialization — for example, after calling destroy() and then deciding to reinitialize the same instance object without creating a new one.update()
Recalculates maximum heights for all currently tracked elements using the currently active options, then emits hequalizer:{handle}:update. Unlike refreshElements(), it does not re-query the DOM — the element list stays the same.
Signature: instance.update(): void
Use update() when you know element heights have changed but no DOM mutation was observed — for example after a lazy-loaded image finishes loading, after an animation completes, or after toggling hidden content that affects layout.
refreshElements()
Disconnects existing MutationObserver instances, re-runs document.querySelectorAll('[data-hequalizer="${handle}"]') to capture any new or removed elements, updates active options for the current breakpoint, recalculates heights, reconnects observers on the new element set, and emits hequalizer:{handle}:refresh.
Signature: instance.refreshElements(): void
Use refreshElements() whenever elements are added to or removed from the group in the DOM. The MutationObserver watches for content changes inside existing elements but does not detect new elements being inserted into the page.
destroy()
Performs a full teardown of the instance: resets values to 0, clears all tracked CSS custom properties from element inline styles, removes all state classes, removes the window resize listener, disconnects and deletes all MutationObserver instances, cancels any pending debounced resize or content-change timeouts, emits hequalizer:{handle}:destroy, and finally removes the instance from Hequalizer.instances — freeing the handle for reuse.
Signature: instance.destroy(): void
Instance properties
The following properties are set during construction and updated as the instance runs. They are publicly readable and useful for debugging or reacting to state inside event listeners.The handle string passed to the constructor. Used as the map key in
Hequalizer.instances and as part of all custom event names.The live collection of elements matched by
[data-hequalizer="{handle}"]. Updated by refreshElements(). Reflects the DOM state at the time of the last query.The last calculated height value(s). When
columns is "all", this is a single number — the maximum offsetHeight across all elements. When columns is a number greater than 1, this is an array of numbers, one per group. Resets to 0 after destroy().The fully resolved options object currently in use — either
allOptions.default or the merged breakpoint options, depending on window.innerWidth. Updated every time a resize event fires or _setActualOptions() runs internally.The identifier of the currently active breakpoint. Set to the string
"default" when no responsive breakpoint matches window.innerWidth, or to the numeric breakpoint value (e.g., 768) when one does.The raw
responsive object passed into the constructor options. Keyed by breakpoint number; values are partial option objects. This is the original reference — not the merged per-breakpoint copies stored in allOptions.The sorted array of numeric breakpoint keys extracted from the
responsive option, ordered from smallest to largest. Used internally to determine which breakpoint is active on each resize.An array of all unique CSS custom property names tracked across the default options and every breakpoint. Because different breakpoints can declare different
cssVariable values, Hequalizer needs to clear all of them before each recalculation to avoid stale values from a previous breakpoint.