` } else { html = `
${m.title}
` } let node = document.createElement("div") node.addEventListener("click", () => { $.post({ url: `https://twtpstat.zhentoo.com/extendstat.ashx?artid=${artid}&extendids=${m.artid}&position=1&type=2`, success: function (result) { location.href = m.url; } }); }) node.innerHTML = html; midiv.appendChild(node) midUrl.push(m.artid); }) fixList.forEach((m, index) => { let html = ``; if (index === 1) { html = `
${m.title}
` } else { html = `
${m.title}
` } let node = document.createElement("div") node.addEventListener("click", () => { $.post({ url: `https://twtpstat.zhentoo.com/extendstat.ashx?artid=${artid}&extendids=${m.artid}&position=2&type=2`, success: function (result) { location.href = m.url; } }); }) node.innerHTML = html; fixdiv.appendChild(node) fixUrl.push(m.artid); }) } }); function hasScrollbar() { return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight); } function closePop23() { document.querySelector("#pop_2_3_fixed").style.transform = "translateY(100vh)" } if (hasScrollbar()) { document.addEventListener("scroll", function () { var scope = (midiv.offsetHeight * (100 - 80)) / 100; //廣告欄可出線範圍大小 var cH = document.documentElement.clientHeight; //當前頁面可見區域高度 var tY = midiv.getBoundingClientRect().top; //廣告欄頂部到可見區域頂端的高度 var bY = midiv.getBoundingClientRect().bottom; //廣告欄底部到可見區域頂端的高度 // 需要考慮兩種可能 當tY小於-scope則代表不在窗口展示 當bY大於cH+scope則代表不在窗口展示 if (tY cH + scope) { } else if (ismid) { ismid = false; var extendids = []; midUrl.forEach(u => { extendids.push(u); }); if (extendids.length > 0) { $.post({ url: `https://twtpstat.zhentoo.com/extendstat.ashx?artid=${artid}&extendids=${extendids.toString()}&position=1&type=1`, success: function (result) { } }); } } }); console.log("bodygundongt") var clint = document.documentElement; var clintbox = document.querySelector(".headling_word_main_box"); //獲取視圖窗口的高度 var windowHeight = document.body.clientHeight; //綁定事件 window.addEventListener('scroll', function () { let SH = parseInt(clint.scrollTop); let H = parseInt(clint.scrollHeight); console.log(SH,clintbox.clientHeight * 2 / 3) if (SH >= clintbox.clientHeight * 2 / 3) { //此時滾動條滾動到底部 if (isshow23) { isshow23 = false; document.querySelector("#pop_2_3_fixed").style.transform = "translateY(0)" var extendids = []; fixUrl.forEach(u => { extendids.push(u); }) $.post({url: `https://twtpstat.zhentoo.com/extendstat.ashx?artid=${artid}&extendids=${extendids.toString()}&position=2&type=1`, success: function (result) { }}); } } }); } else { mainBox.addEventListener("scroll", function () { var scope = (midiv.offsetHeight * (100 - 80)) / 100; //廣告欄可出線範圍大小 var cH = mainBox.clientHeight; //當前頁面可見區域高度 var tY = midiv.getBoundingClientRect().top; //廣告欄頂部到可見區域頂端的高度 console.log(cH); var bY = midiv.getBoundingClientRect().bottom; //廣告欄底部到可見區域頂端的高度 // 需要考慮兩種可能 當tY小於-scope則代表不在窗口展示 當bY大於cH+scope則代表不在窗口展示 if (tY cH + scope) { } else if (ismid) { ismid = false; var extendids = []; midUrl.forEach(u => { extendids.push(u); }) if (extendids.length > 0) { $.post({ url: `https://twtpstat.zhentoo.com/extendstat.ashx?artid=${artid}&extendids=${extendids.toString()}&position=1&type=1`, success: function (result) { } }); } } }); var clint = document.querySelector(".headling_word_main_box"); //獲取視圖窗口的高度 var windowHeight = document.body.clientHeight; //綁定事件 mainBox.addEventListener('scroll', function () { let SH = parseInt(mainBox.scrollTop + windowHeight); let H = parseInt(mainBox.scrollHeight); if (SH >= clint.clientHeight) { //此時滾動條滾動到底部 if (isshow23) { isshow23 = false; document.querySelector("#pop_2_3_fixed").style.transform = "translateY(0)" var extendids = []; fixUrl.forEach(u => { extendids.push(u); }) if (extendids.length > 0) { $.post({ url: `https://twtpstat.zhentoo.com/extendstat.ashx?artid=${artid}&extendids=${extendids.toString()}&position=2&type=1`, success: function (result) { } }); } } } }); }