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

Tom Dickson July 24, 2014

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

0 votes
Answer accepted
Davin Studer
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.
July 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
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.
July 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>

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 25, 2014

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.

Tom Dickson July 25, 2014

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
TAGS
AUG Leaders

Atlassian Community Events