function isScrolledIntoView(o,r){
o=$(o);
var t=$(window),
r=r||0,
e=t.scrollTop(),
i=e+t.height(),
n=o.offset().top+r,
f=n+o.height(),
h=n>i;
console.log(o.offset().top);
if(h)
return!1;
var l=f>e;
return l?!(h&&l):!1
}
浏览器报错Cannot read property 'top' of undefined
但我console.log就能输出这个值,请问是什么问题?
你是不是在其他页面调用了这个函数,而这个这面并没有你传过来的o节点