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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,665
Community Members
 
Community Events
184
Community Groups

Expand-by-default for Expand Macro with Stylesheet

Hi friends! 

I'm looking for a solution to have all my Expand Macros in a site to be expanded as default. My customer mentioned that their users are missing out key information from not clicking on Expand Macros. 

The current space also has too much populated content for me to manually remove all Expand Macros. I had previously created an Expand / Collapse All User Macro that does this on 1 click, but users are still required to click on the User Macro button first. Customer wishes to get rid of the Expand / Collapse All User Macro and change expand to be defaulted. 

Understand that this will require some scripting, those anyone have any such solutions to share that I could perhaps put into the Space's Stylesheet? Is there such a solution to begin with? 

Thank you so much. 

1 answer

1 accepted

1 vote
Answer accepted
Matt
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 12, 2023 • edited

If this is on server/dc, you can add some JS to the Custom HTML section of Admin General Config.

Add this to the "At end of the BODY" section.

<script>
    AJS.toInit(function () {
        AJS.$('.expand-icon').click();
    });
</script>

 

 

Sorry for the late reply Matt and thank you! 
I think in the method you suggested, it would apply to all Expand macros in all my spaces since it's using Admin General Config; just to clarify? 

I tested your solution on a page using the HTML macro and it worked (Hurray!)

However, I did hope that it could be done on a Space level, I used your HTML on Settings > Space Stylesheet but it didn't work; only in using HTML macro within a page did. 

Do you happen to be also experience the same thing? :) 

Matt
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 26, 2023

The space stylesheet will only allow for CSS which is why the first solution won't work, that's making use of JS. 

This can be accomplished using the space's stylesheet with this code:

.expand-hidden { display:inline-block; opacity:1;} 

 

I'd like to warn that this is basically a hack and will change how the expand/collapse functionality works. In order to then have the section collapse a user will have to click it twice. This is because we're doing the expand with CSS so when a user clicks on the link to collapse the JS will first execute the expand command (which we've already done with the CSS) and then again to actually collapse the section. It's a hack but should accomplish what you want.

Like Hua Soon SIM _Akeles_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events