Table of contents generated from h2s inside different div blocks

I’m implementing the TOC feature, wanting the table of contents to generate h2s that are children of separate divs (see picture).
As per Finsweet tutorial, I’m giving following values to divs: contents and contents-2.

Questions:

  1. Tutorial speaks of stacked rich-text-blocks as wrappers of headings. Is it possible to have divs being the wrappers for the h2s, like in my case?
  2. If it is, what should I give values link and link-2 to ? Should I create a new link block with text block inside and give link-2 to this?

Asking as what I’m attempting to do doesn’t seem to work, unless I’m missing something.

In case it’s needed, here’s the build:

https://preview.webflow.com/preview/room4?utm_medium=preview_link&utm_source=designer&utm_content=room4&preview=5e93383403cd7e5df815a68312dd6fb4&pageId=66a1259b031fa9e2512f6058&workflow=preview

Thank you so much!

Hey @giuseppe! I’m afraid it is not very clear to me what you are trying to achieve. Do you have a final design for the ToC at hand? Could you record a quick loom with some more info and details?

Hi Luis, thank you for your quick reply.

Sorry I wasn’t very clear. Here’s the Loom video:

And here’s the Webflow build:
https://preview.webflow.com/preview/room4?utm_medium=preview_link&utm_source=designer&utm_content=room4&preview=5e93383403cd7e5df815a68312dd6fb4&pageId=66a1259b031fa9e2512f6058&workflow=preview

Thank you.

Hey @giuseppe! If you inspect the ToC page, you’ll see the html has a style like → style="scroll-behavior: smooth;"

You can add it with this on your page settings :wink:

<style>
    html {
        scroll-behavior: smooth;
    }
</style>

Thank you!

1 Like