diff options
Diffstat (limited to 'book.js')
-rw-r--r-- | book.js | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -346,7 +346,7 @@ function playground_text(playground, hidden = true) { } setTimeout(function () { - themeColorMetaTag.content = getComputedStyle(document.body).backgroundColor; + themeColorMetaTag.content = getComputedStyle(document.documentElement).backgroundColor; }, 1); if (window.ace && window.editors) { @@ -551,13 +551,6 @@ function playground_text(playground, hidden = true) { firstContact = null; } }, { passive: true }); - - // Scroll sidebar to current active section - var activeSection = document.getElementById("sidebar").querySelector(".active"); - if (activeSection) { - // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView - activeSection.scrollIntoView({ block: 'center' }); - } })(); (function chapterNavigation() { @@ -676,13 +669,14 @@ function playground_text(playground, hidden = true) { }, { passive: true }); })(); (function controllBorder() { - menu.classList.remove('bordered'); - document.addEventListener('scroll', function () { + function updateBorder() { if (menu.offsetTop === 0) { menu.classList.remove('bordered'); } else { menu.classList.add('bordered'); } - }, { passive: true }); + } + updateBorder(); + document.addEventListener('scroll', updateBorder, { passive: true }); })(); })(); |