hasScrollbar
Commons
stable
Returns true when an element has a visible or auto vertical scrollbar. Checks the computed overflowY style and compares scrollHeight to clientHeight. Returns false for non-element nodes and null/undefined inputs.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- elElement | null
- The DOM element to inspect. Falsy values or non-ELEMENT_NODE nodes return false immediately.
API
Return value
The value returned by this util.
- true when the element has overflow-y: scroll, or overflow-y: auto and scrollHeight > clientHeight.
Usage
Examples
Ready-to-paste usage snippets.
Detect scroll container