参考链接http://www.tuicool.com/articles/3aABJr
function getElementTopLeft(obj) {
var top = 0;
var left = 0;
while(obj){
top += obj.offsetTop;
left += obj.offsetLeft;
obj = obj.offsetParent;
}
return {top:top,left:left};
}
if (getElementTopLeft(element).top + element.clientHeight > window.pageYOffset && window.pageYOffset + window.innerHeight > getElementTopLeft(element).top) {
console.log('可见')
} else {
console.log('不可见')
}