DEV: De-jQuerify is-element-in-viewport (#17000)

This commit is contained in:
Penar Musaraj 2022-06-06 12:26:49 +00:00 committed by GitHub
parent 43346ddaa6
commit 210d9c2b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -3,13 +3,12 @@ export default function (element) {
return;
}
const $window = $(window),
rect = element.getBoundingClientRect();
const rect = element.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= $window.height() &&
rect.right <= $window.width()
rect.bottom <= window.innerHeight &&
rect.right <= window.innerWidth
);
}