1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/model/page.helper.ts

25 lines
758 B
TypeScript
Raw Normal View History

2018-05-10 01:56:02 +08:00
export class PageHelper {
private static readonly supportPageOffset = window.pageXOffset !== undefined;
private static readonly isCSS1Compat = ((document.compatMode || '') === 'CSS1Compat');
constructor() {
}
public static get ScrollY(): number {
return this.supportPageOffset ? window.pageYOffset : this.isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
}
public static showScrollY() {
document.getElementsByTagName('body')[0].style.overflowY = 'scroll';
}
public static isScrollYVisible(): boolean {
return document.getElementsByTagName('body')[0].style.overflowY === 'scroll';
}
public static hideScrollY() {
document.getElementsByTagName('body')[0].style.overflowY = 'hidden';
}
}