TheDocumentation 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 constructor is the entry point for every height-equalization group. You call it once per group, passing a handle that ties the JavaScript instance to the HTML elements carrying the matching data-hequalizer attribute. The constructor validates the handle, queries matching elements, builds the full options map (base + each breakpoint), registers the instance in the global registry, and schedules init() to run after document.fonts.ready.
Signature
Parameters
Unique identifier for the element group. Must match the
data-hequalizer attribute value on every target element. Accepts only lowercase letters, numbers, and hyphens in slug format — validated against /^[a-z0-9]+(?:-[a-z0-9]+)*$/. The handle is used as the key in Hequalizer.instances and as part of every custom event name.Optional configuration object applied to this instance. All properties are optional and fall back to built-in defaults when omitted. Breakpoint-specific overrides are nested inside the
responsive key. See the Options reference for the full list of available properties.What the constructor does
When you callnew Hequalizer(handle, options), the following steps run synchronously before control returns:
- Validates the handle — checks it is present, matches the slug regex, and is not already registered in
Hequalizer.instances. - Queries elements — runs
document.querySelectorAll('[data-hequalizer="${handle}"]')and stores the result inthis.$elements. - Builds
allOptions— merges base defaults withoptionsto produceallOptions.default, then iterates every breakpoint key inoptions.responsiveto produce one merged entry per breakpoint. - Collects
cssVariables— extracts every uniquecssVariablevalue across all option sets so they can all be cleaned before each recalculation. - Registers the instance — calls
Hequalizer.instances.set(handle, this)so the instance is immediately reachable viaHequalizer.getInstance(). - Defers
init()— attaches a.then()handler todocument.fonts.ready, ensuring heights are measured after web fonts have loaded and layout is stable.
Error scenarios
The constructor throws a synchronousError for three invalid conditions. All error messages are in Spanish, matching the library’s source.
Code examples
HTML setup
Every element that should be height-equalized must carry thedata-hequalizer attribute whose value exactly matches the handle string.
HTML
CSS
The constructor immediately registers the instance and queries elements, but height calculation is deferred until
document.fonts.ready resolves. Always create Hequalizer instances after the target elements already exist in the DOM — for example inside a DOMContentLoaded listener or at the bottom of the <body>.