Hi Isaac,
If you've got access to Adaptavist's paid Content Formatting Macros for Confluence app you can use the Div and CSS Stylesheet macros to accomplish this. What I did was insert a Div macro and set the ID to sticktotop, then put a panel with a ToC macro inside that. Then I inserted a CSS Stylesheet macro with the following code:
#sticktotop { position: sticky; z-index: 100; top: 0; }
The z-index value is set high to ensure it stays on top of all other elements. The end result is a Table of Contents that scrolls with the user. Let us know if you find any other ways to do this.
Good luck!
Since that solution relies on the CSS Stylesheet macro I assume you could enact something in your global stylesheet, but sadly I don't have any experience with that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have two choices:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can take a look at the article I wrote that talks about wrapper macros: Getting-Started-with-User-Macros-Writing-a-Wrapper-Macro
In this case you would do the same thing with a ToC macro, and just add a classed div statement to it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I was thinking of writing another article around this. An interesting use case. Stay tuned.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jared,
I tried using the CSS Stylesheet macro as you suggested and it doesn't seem to work with the code you provided?
Any suggestions? See attached screenshot showing how I used the CSS Stylesheet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chris,
It looks like there's a minor syntax error in the CSS Stylesheet macro. It should be #sticktotop rather than .sticktotop. Additionally, the Div macro can't be nested in the Section macro, but the reverse seems to work okay for me. Does that fix it for you?
Jared
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jared,
Thanks for the quick response. That fixed it!!!
Thanks,
Chris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome! Let us know if you figure out anything cool to do with it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.