diff --git a/src/theme/book.js b/src/theme/book.js index ff3650eb..1911b118 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -676,13 +676,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 }); })(); })(); diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 6f3948c6..195e41bc 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -115,7 +115,7 @@