Table of contents (toc): offset due to header?

Hello,
I’ve applied the tutorial to add a table of contents to my posts, but it seems like there is annoying offset, that I actually also notice in the tutorial itself (See screenshots below). The toc sticks correctly at the top of the screen, but it seems to believe the page is scrolled much more than it actually is. Tested with Casper 3.5.2 on both Firefox and Chromium.

Could you help in correcting this behavior? Thank you

If you want the heading recognized sooner, add this option to the Tocbot config:

tocbot.init({
    ...
    hasInnerContainers: true,
    });

Amazing, it was as simple as that. Thank you Ryan.

1 Like