Can I make a button to show/hide the sidebar?

Some users don't know about the menu button for hiding the sidebar, so on a specific page I'd like to make a normal HTML button that when clicked toggles the sidebar. Then I can put it in a panel.

2 answers

1 accepted

This widget could not be displayed.
Davin Studer Community Champion Jul 25, 2014

You can certainly do that. All you need to do it edit the page template and put a button somewhere on the page that will fire off some javascript to programatically click the one in your header. Now, from a usability standpoint I think it is a better idea just to educate the users rather than duplicate functionality on the page.

Davin Studer Community Champion Jul 25, 2014

Didn't realize that you want it only an a specific page. Same answer just without editing the template. I would create a user macro to do this. It would look something like this.

## @noparams
<form class="aui">
    <button id="custom-splitter-toggle" class="aui-button">Toggle Sidebar</button>
</form>
<script type="text/javascript">
    AJS.toInit(function(){
        AJS.$('#custom-splitter-toggle').click(function(event){
            AJS.$('#splitter-button').click();
            event.preventDefault();
        });
    });
</script>

This widget could not be displayed.

There's a button on the sidebar to toggle it, next to "space tools". The << and >>

That's in the standard theme though - if you're using a different version of Confluence and/or a different theme, it might not be there, but it might be possible to add it. But we'd need to know what we're working with.

I'm using the Documentation theme, and there is a button right next to search that does what I want, but since it is unlabled people miss it. I'd like to add a second more obvious button in the page text itself.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

406 views 4 6
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you