首先将插件在jq后面引入
var loading = function() {
var st = $(window).scrollTop(),sth = st + $(window).height();
$.each(params.cache,function(i,data) {
var o = data.obj,tag = data.tag,url = data.url;
if(o) {
post = o.position().top;
posb = post + o.height();
if((post > st && post < sth) || (posb > st && posb < sth)) {
if(tag === "img") {
o.attr("src",url);
} else {
o.load(url);
}
data.obj = null;
}
}
});
return false;
};
loading();
$(window).bind("scroll",loading);
};
})(jQuery);
然后在底部初始化