@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
19 lines (18 loc) • 621 B
JavaScript
/**
* Resolves offset value for given axis.
* @param offset - Offset value or object containing axis-specific offsets
* @param axis - Axis for which to resolve the offset ('x' or 'y')
* @returns Resolved offset value for the specified axis
*/
export function resolveOffset(offset, axis) {
if (typeof offset === 'number')
return offset;
return (offset === null || offset === void 0 ? void 0 : offset[axis]) || 0;
}
/**
* Gets the document's scrolling element.
* @returns Scrolling element
*/
export function getDocScrollingEl() {
return document.scrollingElement || document.documentElement;
}