$(function () { const globaldata = { // 用户是否登录 user: false, // 登录弹框 sgin () { $("#toast").addClass("show").find("#sgin").addClass("show").unbind("click").click(function () { window.location.href = "https://www.baidu.com" }); } } // 显示区高度 let ch = document.documentElement.clientHeight || document.body.clientHeight; // 实现评论区加载 let lock = false; $(window).scroll(function () { if (lock) return false; // 滑动区高度 let sh = document.documentElement.scrollHeight || document.body.scrollHeight; // 滑动位置 let st = document.documentElement.scrollTop || document.body.scrollTop; let c = sh * 1 - ch * 1 - st * 1; if (c == 0) { lock = true; $(".comment>.loading").addClass("show") setTimeout(function ( ) { $(".comment>.loading").removeClass("show"); data().then(res => { if (res) { $(".comment>.nodata").addClass("show"); } lock = res; }); }, 2000) } }) // 阅读量问题 // 评论区 function data () { // 请求 根据请求改变内容 唯一标识 data-userid="1" data-good="false" let com = `