From 4ea8249adab0d756b3d4091a01358c97b06ca21d Mon Sep 17 00:00:00 2001 From: Thomas Chartron Date: Sat, 13 Nov 2021 18:25:51 +0100 Subject: [PATCH] update --- src/js/page.js | 2 +- static/js/page.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/page.js b/src/js/page.js index d4bc982..a7f5bb5 100644 --- a/src/js/page.js +++ b/src/js/page.js @@ -164,7 +164,7 @@ document.addEventListener("DOMContentLoaded", function() { // }) }); function setActiveToc(elements) { - elements.reverse(); + // elements.reverse(); return [...elements].find((item) => { return (item.getBoundingRect().y < 0) }) diff --git a/static/js/page.js b/static/js/page.js index 964ad86..15e8e61 100644 --- a/static/js/page.js +++ b/static/js/page.js @@ -1 +1 @@ -function setActiveToc(e){return e.reverse(),[...e].find(e=>e.getBoundingRect().y<0)}document.addEventListener("DOMContentLoaded",function(){document.getElementById("navbar").clientHeight,document.getElementById("toc");const e=document.querySelectorAll("#toc li a");document.getElementById("page-content");let t=!1,n=[];[...e].forEach(e=>{n.push(e.href.substring(e.href.indexOf("#")))});const o=document.querySelectorAll(n.join(","));console.log(o),window.addEventListener("scroll",()=>{!1===t?(e[0].classList.add("bg-blue-800"),t=e[0]):console.log(setActiveToc(o))})}); \ No newline at end of file +function setActiveToc(e){return[...e].find(e=>e.getBoundingRect().y<0)}document.addEventListener("DOMContentLoaded",function(){document.getElementById("navbar").clientHeight,document.getElementById("toc");const e=document.querySelectorAll("#toc li a");document.getElementById("page-content");let t=!1,n=[];[...e].forEach(e=>{n.push(e.href.substring(e.href.indexOf("#")))});const o=document.querySelectorAll(n.join(","));console.log(o),window.addEventListener("scroll",()=>{!1===t?(e[0].classList.add("bg-blue-800"),t=e[0]):console.log(setActiveToc(o))})}); \ No newline at end of file