Skip to content

@technobuddha > react-hooks > DOM > Analysis

Function: scrollbarSize()

ts
function scrollbarSize(): ScrollbarSize;

Defined in: scrollbar-size.ts:14

Calculates the width and height of the browser's scrollbar.

This function creates a temporary DOM element with scrollbars, measures the difference between its offset and client dimensions, and returns the scrollbar's width and height in pixels.

Returns

ScrollbarSize

scrollbarWidth and scrollbarHeight.