diff --git a/src/js/page.js b/src/js/page.js index 61438b6..3e7da21 100644 --- a/src/js/page.js +++ b/src/js/page.js @@ -16,14 +16,14 @@ document.addEventListener("DOMContentLoaded", function() { // Add 'active' class if observation target is inside viewport // console.log(entry) // console.log(entry.intersectionRatio) + console.log('entry', entry) + console.log('current', current_intersectiong_entry) if (entry.isIntersecting) { + console.log('processing') if (current_intersectiong_entry !== null && current_intersectiong_entry.target.getBoundingClientRect().y > 0) { console.log('stop') // return true } - console.log('processing') - console.log('entry', entry) - console.log('current', current_intersectiong_entry) if (current_intersectiong_entry !== null) { console.log('current', current_intersectiong_entry.target.getBoundingClientRect().y) // console.log('should stop') diff --git a/static/js/page.js b/static/js/page.js index ccfc6f5..8ce8135 100644 --- a/static/js/page.js +++ b/static/js/page.js @@ -1 +1 @@ -function findCorrespondingTocTitle(n){return[...document.querySelectorAll("#toc li a")].find(e=>e.href.substring(e.href.indexOf("#"))==="#"+n.id)}document.addEventListener("DOMContentLoaded",function(){document.getElementById("navbar").clientHeight,document.getElementById("toc");var e=document.querySelectorAll("#toc li a");document.getElementById("page-content");let t=null,o=null;const n=new window.IntersectionObserver(e=>{e.some(n=>{if(console.log("observe"),n.isIntersecting){null!==o&&0{l.push(e.href.substring(e.href.indexOf("#")))});const r=document.querySelectorAll(l.join(","));r.forEach(e=>{n.observe(e)})}); \ No newline at end of file +function findCorrespondingTocTitle(n){return[...document.querySelectorAll("#toc li a")].find(e=>e.href.substring(e.href.indexOf("#"))==="#"+n.id)}document.addEventListener("DOMContentLoaded",function(){document.getElementById("navbar").clientHeight,document.getElementById("toc");var e=document.querySelectorAll("#toc li a");document.getElementById("page-content");let t=null,o=null;const n=new window.IntersectionObserver(e=>{e.some(n=>{if(console.log("observe"),console.log("entry",n),console.log("current",o),n.isIntersecting){console.log("processing"),null!==o&&0{l.push(e.href.substring(e.href.indexOf("#")))});const r=document.querySelectorAll(l.join(","));r.forEach(e=>{n.observe(e)})}); \ No newline at end of file