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.
Thanks for your help, everyone!
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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again for your assistance. I need to work with the site admin to build this out further but I appreciate your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.