Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isInViewport(element) {
- var rect = element.getBoundingClientRect();
- var html = document.documentElement;
- return (
- rect.top >= 0 &&
- rect.left >= 0 &&
- rect.bottom <= (window.innerHeight || html.clientHeight) &&
- rect.right <= (window.innerWidth || html.clientWidth)
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement