Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isOnScreen(el) {
- var obj = el.get(0);
- var bounds = obj.getBoundingClientRect();
- var half = bounds.height / 2;
- var onScreen = ((bounds.top + half) < window.innerHeight) && ((bounds.bottom + half) > 0);
- return onScreen;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement