feat: scrolling to the top don't hide the TOC when banner is disabled

This commit is contained in:
saicaca
2024-10-28 19:06:28 +08:00
parent e1a98c4149
commit 201f4c8e23
2 changed files with 11 additions and 9 deletions
+7 -7
View File
@@ -413,18 +413,18 @@ const setup = () => {
}
});
window.swup.hooks.on('visit:end', (visit: {to: {url: string}}) => {
// execute 1s later
setTimeout(() => {
const heightExtend = document.getElementById('page-height-extend')
if (heightExtend) {
heightExtend.classList.add('hidden')
}
}, 200)
const toc = document.getElementById('toc-wrapper');
if (toc) {
toc.classList.remove('toc-not-ready')
}
// Just make the transition looks better
const toc = document.getElementById('toc-wrapper');
if (toc) {
toc.classList.remove('toc-not-ready')
}
}, 200)
});
}
if (window?.swup?.hooks) {
@@ -447,7 +447,7 @@ function scrollFunction() {
}
}
if (toc) {
if (bannerEnabled && toc) {
if (document.body.scrollTop > bannerHeight || document.documentElement.scrollTop > bannerHeight) {
toc.classList.remove('toc-hide')
} else {