@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
7 lines (6 loc) • 347 B
JavaScript
/** Checks if the element in a RTL direction context */
export const isRTL = (el) => getComputedStyle(el || document.body).direction === 'rtl';
export const normalizeScrollLeft = (el, value = null, isRtl = isRTL(el)) => {
value = (value === null) ? el.scrollLeft : value;
return isRtl ? el.scrollWidth - el.clientWidth + value : value;
};