mirror of
https://git.beihong.wang/wangbeihong/blog-source.git
synced 2026-04-24 05:13:03 +08:00
1 line
520 B
JavaScript
Executable File
1 line
520 B
JavaScript
Executable File
$(document).ready(function(){var t=$('[id^="cl-"]'),e=$(".atoc-list a");setActiveCatalogItem=(()=>{var a=$(window).scrollTop()+100;t.each(function(){var t=$(this),o=t.attr("id"),c=$('a[data-target="'+o+'"]');t.offset().top<=a&&(e.removeClass("active"),c.addClass("active"))})}),setActiveCatalogItem(),$(window).scroll(()=>{setActiveCatalogItem()});const a=new IntersectionObserver(t=>{t.forEach(t=>{const e=$(".widget-toc-main");t.isIntersecting?e.show():e.hide()})}),o=document.querySelector("#post");o&&a.observe(o)}); |