Raw
1 export function isInView(element: Element): boolean {
2 const rect = element.getBoundingClientRect()
3 return (
4 rect.top >= 0 &&
5 rect.left >= 0 &&
6 rect.bottom <=
7 (window.innerHeight || document.documentElement.clientHeight) &&
8 rect.right <= (window.innerWidth || document.documentElement.clientWidth)
9 )
10 }