You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-wallet/src/utils/windowUtils.js

28 lines
901 B

/* @flow */
export const getViewportHeight = (): number =>
// $FlowIssue: "clientHeight" missing in null
document.documentElement.clientHeight || document.body.clientHeight;
export const getScrollX = (): number => {
if (window.pageXOffset !== undefined) {
return window.pageXOffset;
}
if (window.scrollLeft !== undefined) {
return window.scrollLeft;
}
// $FlowIssue: parentNode || scrollLeft missing
return (document.documentElement || document.body.parentNode || document.body).scrollLeft;
};
export const getScrollY = (): number => {
if (window.pageYOffset !== undefined) {
return window.pageYOffset;
}
if (window.scrollTop !== undefined) {
return window.scrollTop;
}
// $FlowIssue: parentNode || scrollTop missing
return (document.documentElement || document.body.parentNode || document.body).scrollTop;
};