Optional
options: { active?: boolean; axis?: "x" | "y"; noCache?: boolean }Optional
active?: booleanIf true, then if the target's current scroll offset is 0, it will attempt to scroll it rather than looking at its overflow.
Optional
axis?: "x" | "y"One of "x" or "y" for horizontal or vertical scroll respectively. If not given, it checks both.
Optional
noCache?: booleanBy default the result of a check is cached for 1s and if there's already a cached result for this element, it is returned. Set this to true to disable checking the cache and also saving the result into the cache.
Returns true if the given element is scrollable in the given direction, or in either direction (if
axis
is not given).It first checks whether the current scroll offset on the target along the given axis is non-0, and if so returns true immediately. Otherwise it will attempt to determine if it's scrollable using one of these methods (controlled by
options.active
):clientWidth/Height
,scrollWidth/Height
as well as the computedoverflow
CSS property to try to determine if the target is scrollable. This is not 100% reliable but is safer than the active checkNOTE: If the layout has been invalidated and not yet recalculated, this will cause a forced layout, so always waitForMeasureTime before calling this function when possible.