ngx-bootstrap
Version:
Angular Bootstrap
14 lines • 559 B
JavaScript
/**
* Gets the scroll value of the given element in the given side (top and left)
*/
export function getScroll(element, side = 'top') {
const upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
const nodeName = element.nodeName;
if (nodeName === 'BODY' || nodeName === 'HTML') {
const html = element.ownerDocument.documentElement;
const scrollingElement = element.ownerDocument.scrollingElement || html;
return scrollingElement[upperSide];
}
return element[upperSide];
}
//# sourceMappingURL=getScroll.js.map