window.addEventListener('scroll', function () {
if(window.pageYOffset + window.innerHeight >= document.documentElement.scrollHeight){
alert(0);
}
})
解决多次触发可以设定一个变量控制
var d = true;
window.addEventListener('scroll', function () {
if(window.pageYOffset + window.innerHeight >= document.documentElement.scrollHeight){
if(d){
$.post("ourphp.php",{id:id},function(result){
if(result == 0){
//数据加载完
d = false;
return;
}else{
//加载新数据
d = true;