ivue-material-plus
Version:
A high quality UI components Library with Vue.js
23 lines (21 loc) • 848 B
JavaScript
function getTargetRect(target) {
return target !== window ? target.getBoundingClientRect() : { top: 0, bottom: window.innerHeight };
}
function getFixedTop(placeholderReact, targetRect, offsetTop) {
if (offsetTop !== void 0 && targetRect.top > placeholderReact.top - offsetTop) {
return offsetTop + targetRect.top;
}
return void 0;
}
function getFixedBottom(placeholderReact, targetRect, offsetBottom) {
if (offsetBottom !== void 0 && targetRect.bottom < placeholderReact.bottom + offsetBottom) {
const targetBottomOffset = window.innerHeight - targetRect.bottom;
return offsetBottom + targetBottomOffset;
}
return void 0;
}
function getDefaultTarget() {
return typeof window !== "undefined" ? window : null;
}
export { getDefaultTarget, getFixedBottom, getFixedTop, getTargetRect };
//# sourceMappingURL=utils.mjs.map