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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage
Highlighted

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!

3 comments

Thomas Schlegel Community Leader 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 Darin_Lory likes this

Comment

Log in or Sign up to comment
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

480 views 24 9
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you