mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-05-21 22:14:06 +03:00
improve style method
This commit is contained in:
@@ -102,9 +102,10 @@ export const createOverflowLifecycle = (lifecycleHub: LifecycleHub): Lifecycle =
|
||||
const { x: overlaidX, y: overlaidY } = _nativeScrollbarIsOverlaid;
|
||||
const determineOverflow = !viewportStyleObj;
|
||||
const arrangeHideOffset = _content && !_nativeScrollbarStyling && !showNativeOverlaidScrollbars ? overlaidScrollbarsHideOffset : 0;
|
||||
const styleObj = determineOverflow ? style(_viewport, ['overflowX', 'overflowY']) : viewportStyleObj;
|
||||
const scroll = {
|
||||
x: (determineOverflow ? style(_viewport, 'overflow-x') : viewportStyleObj!.overflowX) === 'scroll',
|
||||
y: (determineOverflow ? style(_viewport, 'overflow-y') : viewportStyleObj!.overflowY) === 'scroll',
|
||||
x: styleObj!.overflowX === 'scroll',
|
||||
y: styleObj!.overflowY === 'scroll',
|
||||
};
|
||||
const scrollbarsHideOffset = {
|
||||
x: scroll.x && !_nativeScrollbarStyling ? (overlaidX ? arrangeHideOffset : _nativeScrollbarSize.x) : 0,
|
||||
|
||||
@@ -34,7 +34,7 @@ const parseToZeroOrNumber = (value: string, toFloat?: boolean): number => {
|
||||
const adaptCSSVal = (prop: string, val: string | number): string | number => (!cssNumber[prop.toLowerCase()] && isNumber(val) ? `${val}px` : val);
|
||||
const getCSSVal = (elm: HTMLElement, computedStyle: CSSStyleDeclaration, prop: string): string =>
|
||||
/* istanbul ignore next */
|
||||
computedStyle != null ? computedStyle.getPropertyValue(prop) : elm.style[prop];
|
||||
computedStyle != null ? computedStyle[prop] || computedStyle.getPropertyValue(prop) : elm.style[prop];
|
||||
const setCSSVal = (elm: HTMLElement | null | undefined, prop: string, val: string | number): void => {
|
||||
try {
|
||||
if (elm && elm.style[prop] !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user