1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-14 11:23:17 +02:00
pigallery2/frontend/app/model/page.helper.ts
2018-05-09 13:56:02 -04:00

25 lines
758 B
TypeScript

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