diff --git a/src/module/post.js b/src/module/post.js index cfddb0d..7ee2e64 100644 --- a/src/module/post.js +++ b/src/module/post.js @@ -98,7 +98,7 @@ async function locateToc() { const buttonWidth = toc_toggle.offsetWidth; const tocWidth = toc.classList.contains('toc-visible') ? toc.offsetWidth : buttonWidth; - const maxLeft = screenWidth - tocWidth - 30; + const maxLeft = screenWidth - content.offsetLeft - 20; leftPosition = Math.min(leftPosition, maxLeft); leftPosition = Math.max(leftPosition, 30); diff --git a/src/styles/toc.scss b/src/styles/toc.scss index d815307..ef816fe 100644 --- a/src/styles/toc.scss +++ b/src/styles/toc.scss @@ -82,6 +82,10 @@ display: none; } } + + .toc.toc-visible { + max-width: 25vw + } } .toc-toggle {