Created
January 17, 2020 20:28
-
-
Save stevedya/dafbdddb39d0ba6572c6963213ca2ffa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isVisible (ele) { | |
const { top, bottom } = ele.getBoundingClientRect(); | |
const vHeight = (window.innerHeight || document.documentElement.clientHeight); | |
return ( | |
(top > 0 || bottom > 0) && | |
top < vHeight | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment