diff options
author | johannst <johannst@users.noreply.github.com> | 2023-07-21 18:14:59 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2023-07-21 18:14:59 +0000 |
commit | c4435063f699569dd1688966c20748f61d56683c (patch) | |
tree | 89c2710f5548b626817f00f6d8799b4ca76944d2 /book.js | |
parent | 1b251a08f8c10ff292d1ca9b1c580e88df483b94 (diff) | |
download | notes-c4435063f699569dd1688966c20748f61d56683c.tar.gz notes-c4435063f699569dd1688966c20748f61d56683c.zip |
deploy: a311d67451eb4734684f314f1b56021da86459a0
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 }); })(); })(); |