UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

40 lines (39 loc) 1.93 kB
/** Checks if element is blocked from scrolling */ export declare function isScrollLocked(target: Element): boolean; /** Checks vertical scroll based on content height */ export declare function hasVerticalScroll(target?: Element): boolean; /** Checks horizontal scroll based on content height */ export declare function hasHorizontalScroll(target?: Element): boolean; export type ScrollLockOptions = { /** * Option to lock scroll: * - 'none' | null | undefined - totally locks scroll with `overflow: hidden` option * - 'native' (applicable for page only) - left page scroll visible but inactive * - 'pseudo' (applicable for page only) - uses padding offset to make page static on lock * - 'background' (applicable for page only) - uses padding offset to make page static on lock and uses small pseudo-scrollbar z-index */ strategy?: 'none' | 'native' | 'pseudo' | 'background' | null; /** Locks all scrollable parents */ recursive?: boolean; /** Initiator (requester) object to limit lock operations by the query */ initiator?: any; }; /** * Disables a scroll on the element. * @param target - scrollable element which will be blocked from scrolling * @param options - additional options to lock scroll * */ export declare function lockScroll(target?: Element, options?: ScrollLockOptions): void; /** * Enables a scroll on the target element in case it was requested with given initiator. * @param target - scrollable element * @param options - additional options to unlock scroll */ export declare function unlockScroll(target?: Element, options?: ScrollLockOptions): void; export interface ElementScrollOffset { element: Element; top: number; left: number; } export declare function isOffsetChanged(offsets: ElementScrollOffset[]): boolean; export declare function getParentScrollOffsets($el: Element, $topContainer: Element): ElementScrollOffset[];