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

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

el
Element | null
The DOM element to inspect. Falsy values or non-ELEMENT_NODE nodes return false immediately.

API

Valeur de retour

La valeur retournée par cet util.

true when the element has overflow-y: scroll, or overflow-y: auto and scrollHeight > clientHeight.

Usage

Exemples

Extraits de code prêts à coller.

Detect scroll container

typescript