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
|
|
|
}
|
|
|
|
}
|