diff --git a/internal/web/static/jump.js b/internal/web/static/jump.js index 03fb611..cb1574b 100644 --- a/internal/web/static/jump.js +++ b/internal/web/static/jump.js @@ -38,4 +38,14 @@ window.addEventListener('resize', refresh); if (scroller !== window && scroller) scroller.addEventListener('input', refresh); refresh(); + /* #282: the first evaluation can run before the layout settles (media + queries, web fonts, async highlighting) and under-measure the content, + leaving the nav hidden on long pages. Re-check once a real layout exists + and after load; the ResizeObserver also catches late content growth. */ + requestAnimationFrame(function () { requestAnimationFrame(refresh); }); + window.addEventListener('load', refresh); + window.setTimeout(refresh, 300); + if (window.ResizeObserver && scroller === window && document.body) { + new ResizeObserver(refresh).observe(document.body); + } })();