$(function () { const globaldata = { active: 0 } $(".my-nav").click(function (e) { console.log() let active = Array.prototype.slice.call($(this).find("li")).indexOf(e.target); if (active == globaldata.active) return false; globaldata.active = active; $(this).find(".active").removeClass("active"); $(e.target).addClass("active"); $(".ke>.active").removeClass("active"); $($(".ke>.my-list")[active]).addClass("active"); }) // 加载数据 // 显示区高度 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; $(".my-loading").show(); data().then(res => { lock = res; $(".my-loading").hide(); }) } }) // 加载数据 function data () { let str = `
广东省警察学院:从未委托任何个人或机构进行招生宣传;广东省警察学院:从未委托任何个人或机构进行招生宣传
高考动态2021-04-21
` return new Promise(resolve => { setTimeout(() => { // globaldata.active 请求不同数据 $(".ke>.active").append(str); resolve(false) }, 2000) }) } let str = `heml`; // 底部弹出框 $("[data-toggle='popover']").data("html", "123").popover({ html: true }); })