Assigns type to nativeElement

This commit is contained in:
Aaron Louie 2019-10-21 22:55:17 -04:00
parent 2b0cf1a94b
commit c193929bdd
1 changed files with 2 additions and 1 deletions

View File

@ -11,7 +11,8 @@ export const isEven = (i: number, ifTrue?: string, ifFalse?: string): string | b
export const getScrollState = (el: ElementRef): string => {
const hOffset = window.innerHeight * 0.75;
const componentPosition = el.nativeElement.offsetTop;
const nativeEl: HTMLElement = el.nativeElement;
const componentPosition = nativeEl.offsetTop;
const scrollPosition = window.pageYOffset + hOffset;
return scrollPosition >= componentPosition ? 'show' : 'hide';
}