diff --git a/src/theme/book.js b/src/theme/book.js index 263e8ad05b..7ff71d504c 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -521,10 +521,12 @@ function playpen_text(playpen) { }, { passive: true }); // Scroll sidebar to current active section - var activeSection = sidebar.querySelector(".active"); - if (activeSection) { - sidebarScrollBox.scrollTop = activeSection.offsetTop; - } + window.addEventListener('load', function() { + var activeSection = sidebar.querySelector(".active"); + if (activeSection) { + activeSection.scrollIntoViewIfNeeded(); + } + }); })(); (function chapterNavigation() {