var time1;var srcollOld = 0,srcollNow = 0,scrollFun = false;$(window).scroll(function () { //$(window).scrollTop()这个方法是当前滚动条滚动的距离 //$(window).height()获取当前窗体的高度 //$(document).height()获取当前文档的高度 var bot = 50; //bot是底部距离的高度 if ((bot + $(window).scrollTop() ) >= ($(document).height() - $(window).height())) { srcollNow = $(window).scrollTop(); if(srcollNow >= srcollOld){ if(!scrollFun){ //第一次请求完成后才发第二次请求 scrollFun = true; clearTimeout(time1); time1=window.setTimeout(function(){ loadAjax() },500); } } srcollOld = srcollNow; }});function loadAjax(){ $.ajax({ url: url, type: type, success:function (data) { scrollFun = false; if (data.success == true) { }else{ } }, error: function(XMLHttpRequest, textStatus, errorThrown) { scrollFun = false; } });}
--------------------------------------------------------------------------------------------------------------------------------------------------------
var pageNum = 5; var listHeight = $(".house-list").height(); var scrollFun = false; var time1; //获取购买数据 function getBuyData(releaseType, pageSize) { $.ajax({ url: apis + "wap/house/page/filter?releaseType=" + releaseType + "&pageSize=" + pageSize, type: "GET", dataType: "json", success: function(data) { scrollFun = false; console.log(data); if(data.code == "000000") { var buyData = data.data console.log(buyData) var html = ""; for(var i of buyData) { console.log(i) html += `
${"$"+countSum(i.price)}
455sqft
4bd
4ba