This commit is contained in:
Jerry Kim 2025-01-24 13:47:54 +08:00 committed by GitHub
commit 44732e8456
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -125,6 +125,15 @@ function setupScrollspy() {
scrollHandler();
}
// Use ResizeObserver to detect changes in the size of .article-content
const articleContent = document.querySelector(".article-content");
if (articleContent) {
const resizeObserver = new ResizeObserver(() => {
resizeHandler();
});
resizeObserver.observe(articleContent);
}
window.addEventListener("resize", debounced(resizeHandler));
}