none
//fully
const isInViewport = (el) => {
var rect = el.getBoundingClientRect();
return {
y: rect.top >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight),
x: rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth)
}
}
//partial
function elementInViewport2(el) {
var top = el.offsetTop;
var left = el.offsetLeft;
var width = el.offsetWidth;
var height = el.offsetHeight;
while(el.offsetParent) {
el = el.offsetParent;
top += el.offsetTop;
left += el.offsetLeft;
}
return (
top < (window.pageYOffset + window.innerHeight) &&
left < (window.pageXOffset + window.innerWidth) &&
(top + height) > window.pageYOffset &&
(left + width) > window.pageXOffset
);
}