Floating table of contents without addons

stringsonfire
Contributor
June 7, 2019

Hi

Is it possible to add a floating table of contents without any additional addons in Confluence 6.13.4 Datacentre? The HTML Macro is available, but as we're using Datacentre it's not feasible to add any additional styling addons like "Content Formatting" for this.

I'd like to use the page layout "Two column section with left-sidebar" to hold the TOC, and make it so that when scrolling down, once you reach the bottom of the TOC, the TOC doesn't continue to scroll up with the rest of the page, so it's always accessible.

Other solutions on here are either outdated or rely on addons that we can't use.

Thanks

 

3 answers

1 vote
Michael Yang - Shinetech Software
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
December 24, 2019

You can try this free macro https://marketplace.atlassian.com/1221271, it supports TOC to be scrolled as well.

René Lopez
Contributor
December 10, 2021

does it work on Confluence Cloud?

Like # people like this
Tauwa
Contributor
November 21, 2022

no !

Like Okurka likes this
Michael Yang - Shinetech Software
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
December 11, 2022

@René Lopez We've released the cloud version: https://marketplace.atlassian.com/1221271

0 votes
Flummiboy
Contributor
August 21, 2024

Hi, I found an answer that you can use even if are not an admin, or you do not have the right to add CSS into the system.

 

  1. insert the TOC macro
  2. Set the CSS-class input to: toc-float
  3. insert a HTML macro after the TOC
  4. Put the following html in:
  5. <style>
    .toc-float {
        top: 100px;
        position: fixed;
        border: 1px solid black;
        padding: 20px
    }
    .toc-float::before {
        content:'Table of contents';
        font-size: 1.2em;
    }

    </style>
  6. You can change the css if you want.
  7. If it does not work, try deleting some whitespaces & newlines in the HTML

This solution has one downside I could not solve yet: the header (edit button) will not come slide in when scrolling up. Maybe someone has a solution for this?

Michael Sharp
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 21, 2024

Thank you!

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 10, 2019

Hello Daniel,

I’ve personally responded to a similar post about wanting a floating Table of Contents (ToC). You can accomplish what you are looking for with simple CSS modifications to Confluence. An example of this can be similar to the following:

(Place this under Space Tools > Look and Feel > Stylesheet)

.toc-macro {
float: right;
position: fixed;
width: 250px;
right: 0px;
top: 170px;
background: rgba(229, 232, 232, 0.80);
border: 1px solid #0096d6;
padding: 5px;
}

You may also read through the post which covers this topic further at: Highlighting current toc item (header) while scrolling.

I hope this proves helpful in being able to float your table of contents.

Regards,
Stephen Sifers

stringsonfire
Contributor
June 10, 2019

It's part-way there, but only works with a relatively short table of contents. I'd need the TOC to be scrollable too.

 

I think what I should be able to do is put the TOC in a narrow left column and use the following, so that the contents scrolls with the page, but only until the end of the TOC, then it becomes sticky:

 

 

.toc-macro {  

    position: -webkit-sticky;  

    position: sticky;  

    bottom: 0;  

}  

 

However, no variation of this seems to work. I think there might be a bug with "position" in Confluence Server/Datacentre

 

Like Sebastian likes this
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 10, 2019

Hello Daniel,

Thank you for the clarification of what you're needing along with your example your testing with.  So we can also test and confirm if this is a defect with the product, could you please send a screenshot of what you have along with the version of Confluence you're currently running?

We look forward to hearing back to help find the cause of the ignored CSS along with helping find a solution for your TOC needs.

Regards,
Stephen Sifers

Like Manpreet Sandhu likes this
Tosin.Ojikutu
Contributor
June 12, 2022

Hi Stephen, Just wanted to check to see if we were able to resolve this issue from a few years back. 

If so, it would be cool to know the solution so we may all adopt it for our own floating table of contents.

Thanks in advance. 

Like # people like this
Dan.Gummerson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 18, 2024

@stringsonfire I'm curious as well, did you ever figure it out? 

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events