var thisPageIndex = 1; var thisRow = 30; var thisLot = window.location.pathname.split(".")[0].split("/")[2] $(function () { $(".back").click(function () { var origin = window.location.origin; window.location.href = origin + "/zx/index.html"; }) $(".news-item").click(function () { localStorage.href = window.location.href; }) setTimeout(wrapperScroll, 1000); }) function getMore() { var load = layer.load(2, { shade: [0.1, '#000'] }); $.ajax({ url: "/ZX/ZXGDList", type: "post", async: false, data: { c: thisLot, p: thisPageIndex + 1, r: thisRow }, success: function (res) { layer.close(load); if (res != "") { thisPageIndex = thisPageIndex + 1; $("#v-morezx-wrapper").append(res); } else { layer.msg("没有更多数据了!") } }, error: function (err) { console.log(err); layer.close(load); } }) } function wrapperScroll() { var wrapper = $("#v-morezx-wrapper")[0]; wrapper.addEventListener("scroll", function () { var ch = wrapper.clientHeight; var st = wrapper.scrollTop; var sh = wrapper.scrollHeight; if (st + ch - sh >= -20) { getMore(); } }) }