Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Expand All Fields on Confluence Page

daniel_mcgrath May 4, 2020

Hello, 

I'm trying to create an expand all button for my confluence page. I have several expandable sections on my page and want to give users the option to expand all fields on the page with a single click. 

I've tried to find a macro using the + > view more without success. 

I've also tried to imbed some java code on the page which I've found on similar posts but keep striking out as it's unclear to me how to place the code onto the page. 

Here's a screenshot of one of the expandable fields.   

expand.png  

Thanks for your help, everyone! 

 

1 answer

0 votes
repi
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.
May 5, 2020

This Macro user could help:

## Macro title: Expand All
## Macro has a body: N
## Date created: 2016-03-11
## Installed by: repi
## @param Titel:title=Titel|type=string|required=true|default=Alles erweitern/kollabieren|desc=Angezeigter Text
<a id="toggleAll" href="#" class="aui-button aui-button-subtle">$paramTitel</a>
<script type="text/javascript">
AJS.toInit(function (){
var expandiert = false;
AJS.$('#toggleAll').click(function(){
if (expandiert) {
var content = jQuery('.expand-content')
.addClass('expand-hidden')
.css({'display': 'none', 'opacity': 0});
content.prev('.expand-control').find('.expand-control-icon').removeClass('expanded');

} else {
var content = jQuery('.expand-content.expand-hidden')
.removeClass('expand-hidden')
.css({'display': 'block', 'opacity': 1});
content.prev('.expand-control').find('.expand-control-icon').addClass('expanded');
}
expandiert = !expandiert;
});
});
</script>

 Macro text is German. Change accordingly ...

hth

daniel_mcgrath May 5, 2020

Thanks for your help - Does the script get imbedded directly on the page as Ive done below? 

Is the expectation that when I preview the page it will turn into a button? 

page.png

repi
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.
May 5, 2020

The script must first be created as a user macro. This can then be seen in the Macro Browser and can then be installed on the  pages.

expandall_3.png

 

expandall_4.png

expandall_1.png

expandall_2.png

daniel_mcgrath May 7, 2020

Thanks again for your assistance. I need to work with the site admin to build this out further but I appreciate your help! 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events