UNPKG
polaris-glints
Version:
latest (15.12.0)
15.12.0
15.11.0
15.10.0
15.9.0
15.8.0
15.7.0
15.6.0
15.5.0
15.4.0
15.3.0
15.2.0
15.1.0
15.0.0
14.0.0
13.0.0
12.0.1
12.0.0
11.0.0
10.19.0
10.18.0
Glints forked polaris react
aries.glints.design
glints-dev/polaris
polaris-glints
/
build
/
esm
/
utilities
/
is-element-in-viewport.js
12 lines
(10 loc)
•
259 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
function
isElementInViewport
(
element
) {
const
{ top, left, bottom, right } = element.
getBoundingClientRect
();
return
top >=
0
&& right <=
window
.
innerWidth
&& bottom <=
window
.
innerHeight
&& left >=
0
; }
export
{ isElementInViewport };