mirror of
https://github.com/tchartron/blow
synced 2024-11-23 21:03:16 +00:00
update
This commit is contained in:
parent
e8e24520d1
commit
c661f5414b
1 changed files with 1 additions and 1 deletions
|
@ -1 +1 @@
|
|||
function getActiveTocElement(e){return[...e].find(e=>e.getBoundingClientRect().y<=0)}function findCorrespondingTocTitle(t){return[...document.querySelectorAll("#toc li a")].find(e=>e.href.substring(e.href.indexOf("#"))==="#"+t.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=[];[...e].forEach(e=>{t.push(e.href.substring(e.href.indexOf("#")))});const n=document.querySelectorAll(t.join(","));let o=[...n].reverse();e=getActiveTocElement(o)||n[0];findCorrespondingTocTitle(e).classList.add("bg-blue-700");var i=e;window.addEventListener("scroll",()=>{var e=getActiveTocElement(o)||n[0];e!==i&&(findCorrespondingTocTitle(i).classList.remove("bg-blue-700"),findCorrespondingTocTitle(e).classList.add("bg-blue-700"),i=e)})});
|
||||
function getActiveTocElement(e){return[...e].find(e=>e.getBoundingClientRect().y<=0)}function findCorrespondingTocTitle(n){return[...document.querySelectorAll("#toc li a")].find(e=>e.href.substring(e.href.indexOf("#"))==="#"+n.id)}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("#toc li a");let n=[];[...e].forEach(e=>{n.push(e.href.substring(e.href.indexOf("#")))});const t=document.querySelectorAll(n.join(","));let i=[...t].reverse();e=getActiveTocElement(i)||t[0];findCorrespondingTocTitle(e).classList.add("bg-blue-700");var o=e;window.addEventListener("scroll",()=>{var e=getActiveTocElement(i)||t[0];e!==o&&(findCorrespondingTocTitle(o).classList.remove("bg-blue-700"),findCorrespondingTocTitle(e).classList.add("bg-blue-700"),o=e)})});
|
Loading…
Reference in a new issue