Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

implementing an "expand all" option on your Confluence page

I was frustrated by the lack of options I was finding when I searched the community for a way to give users a one-click method for expanding all collapsed sections on a Confluence KB page (on an FAQ page, for example), so when my tech team solved the problem for me, I thought I'd share it with you all.

The key is to use the UI Expand macro for the collapsible sections (I had been using the Expand macro). Then you add an HTML macro to the page with script like this:

<script language="JavaScript"> function expandUI(){ var a = document.getElementsByClassName("rwui_expandable_item_title rwui_expand"); for (let i = 0; i < a.length; i++){ a[i].click(); } } </script> <input type="button" value="Expand All" onClick="expandUI();">

Our page starts off with the sections all collapsed. When the user clicks the button created by this HTML macro, all of the collapsed sections expand.

Works perfectly!

5 comments

Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 16, 2019

Hi @Diane G ,

thank you for sharing the solution - but please be aware of the potential security risk you take by enabling the html macro. 

A user can enter any html with this macro, maybe harmless, maybe not.  

I would always put such a script into a user macro and publish this user macro instead of the html macro.

Like # people like this

How to you find the "Expand All" macro to install in confluence?

Like Jessica Martin likes this

Wondering if on UI expand marco is expanded and the other is not. Is there a way to have one button that opens them all and closes them all ? 

Like # people like this

Any modifications to the HTML above to Expand all of the "Expand" Macros on the page?  We want to enable all the FAQs on one page to expand using this button.

At the very least I wish you could set the expand box to autoexpand on load so that search can work.

It's a pity that searching the page (browser search) can't find things in collapsed sections.

Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 24, 2023

I would vote for that, as well as expand and collapse all options in the navigation ellipses for every page level containing sub-pages.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events