1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-13 20:08:56 +00:00
trezor-wallet/src/js/utils/windowUtils.js

18 lines
562 B
JavaScript
Raw Normal View History

2018-02-20 09:30:36 +00:00
/* @flow */
'use strict';
export const getViewportHeight = (): number => (
2018-04-16 21:19:50 +00:00
// $FlowIssue
window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight // $FlowIssue
2018-02-20 09:30:36 +00:00
)
export const getScrollY = (): number => {
if (window.pageYOffset !== undefined) {
return window.pageYOffset;
} else if (window.scrollTop !== undefined) {
return window.scrollTop;
} else {
2018-04-16 21:19:50 +00:00
// $FlowIssue
return (document.documentElement || document.body.parentNode || document.body).scrollTop; // $FlowIssue
2018-02-20 09:30:36 +00:00
}
}