vuetify
Version:
Vue Material Component Framework
23 lines • 726 B
JavaScript
export function getScrollParent(el) {
while (el) {
if (hasScrollbar(el)) return el;
el = el.parentElement;
}
return document.scrollingElement;
}
export function getScrollParents(el, stopAt) {
const elements = [];
if (stopAt && el && !stopAt.contains(el)) return elements;
while (el) {
if (hasScrollbar(el)) elements.push(el);
if (el === stopAt) break;
el = el.parentElement;
}
return elements;
}
export function hasScrollbar(el) {
if (!el || el.nodeType !== Node.ELEMENT_NODE) return false;
const style = window.getComputedStyle(el);
return style.overflowY === 'scroll' || style.overflowY === 'auto' && el.scrollHeight > el.clientHeight;
}
//# sourceMappingURL=getScrollParent.mjs.map